Would a Muslim be sinful if his foot passed over a grave or close to it while he was traversing a long cemetery to reach another mosque, in order to avoid praying in a mosque where a grave was built after its construction?
It is forbidden to build mosques over graves or to bury the dead within them, due to the Prophet's (peace be upon him) prohibition of taking graves as places of worship and his cursing of the Jews and Christians who did so. As for passing through cemeteries, it is better to avoid it if possible. Walking over graves or between them with shoes is disliked by some scholars, while others see no harm in it. The well-known position in the Shafi'i madhhab is that it is not disliked.
Summarized from the full answer at Ftawy · reviewed Sep 2, 2026
Read the full answer on Ftawyhttps://ftawy.com/en/questions/81365