What is the ruling on praying in a mosque that was built before a grave was placed inside it in the direction of the Qiblah, and what should be done regarding this matter?
It is forbidden to build mosques over graves and to bury the dead in mosques, due to the prohibitions and warnings mentioned in the noble prophetic hadiths. Mosques and graves do not co-exist; whichever came into existence later must be removed. If it is impossible to remove either the mosque or the grave, prayer is permissible in the mosque containing a grave, as long as there are no polytheistic practices such as supplicating to the dead or circumambulating the grave. Otherwise, prayer therein is impermissible.
Summarized from the full answer at Ftawy · reviewed Sep 2, 2026
Read the full answer on Ftawyhttps://ftawy.com/en/questions/32232