the worshipper is not aiming at the grave at all; his intention is to worship Allah alone. Yet praying beside a grave is a means that leads to glorifying the grave and, in the end, to treating it as an idol that is worshipped instead of Allah.
Question: What about raising the grave above ground level—what is the ruling on that?
Answer: Elevating a grave is likewise impermissible. The established Sunnah from the Prophet ﷺ is that the grave is filled in with its own soil and raised only about one handspan above the earth so that it can be recognised as a grave. It must not be raised any higher than that, and nothing is to be built over it. No wall or stone edging may be put around it except what is strictly needed to keep the grave and its soil from being trampled. As for erecting an elevated structure over it, or building a mosque on top of it, all of this belongs to the practices of the pre-Islamic age of ignorance and is contrary to the guidance of Islam.
The religion of Islam is founded upon tawhid (the oneness of God), sincere devotion in worship to Allah alone, and the blocking of every avenue that leads to shirk (associationism). That is the true religion of Islam.
***
Magic (sorcery)
Question: Is it permissible to pray behind a sorcerer or someone who believes in sorcery? And is it allowed to remove magic by using magic if no other means are available?
Answer: Sorcery is among the gravest of the major sins. The Prophet ﷺ said: “Avoid the seven deadly sins.” They asked, “What are they, O Messenger of Allah?” He replied, “Associating partners with Allah, sorcery, killing a soul…”—and so on, to the end of the ḥadīth.