What is the ruling on praying in a mosque located in the middle of a graveyard, necessitating passage through graves to reach it?
It is not permissible to pray at graves or to take them as mosques. Whoever prays in a graveyard must repent and seek forgiveness, and does not need to repeat the prayer according to the majority of scholars, including the Hanafis, Malikis, and Shafi'is. This is also one narration from Ahmad. Scholars have differed regarding the validity of prayer in a graveyard: Ali, Ibn Abbas, and others disliked it, while Abu Hurayrah and others did not. Al-Shafi'i has a detailed explanation on the matter. The relied-upon position of the Hanbalis is that prayer in a graveyard is not valid, based on the Prophet's (peace be upon him) saying: "The entire earth is a mosque, except for the graveyard and the bathhouse."
Summarized from the full answer at Ftawy · reviewed Sep 2, 2026
Read the full answer on Ftawyhttps://ftawy.com/en/questions/38686