Questions about whether it is permissible to pray in a mosque with graves located behind it often stem from several prophetic traditions that, at first glance, appear to prohibit such practices. However, as is customary in Islamic scholarship, understanding these hadiths requires more than a literal reading. Scholars examine their chains of transmission, wording, and underlying legal reasoning (‘illah).
One of the most frequently cited hadiths is the saying of the Prophet Muhammad:
لَعَنَ اللَّهُ الْيَهُودَ وَالنَّصَارَى اتَّخَذُوا قُبُورَ أَنْبِيَائِهِمْ مَسْجِدًا قَالَتْ وَلَوْلَا ذَلِكَ لَأَبْرَزُوا قَبْرَهُ غَيْرَ أَنِّي أَخْشَى أَنْ يُتَّخَذَ مَسْجِدًا.
(رواه البخاري)
“God has cursed the Jews and Christians; they took the graves of their prophets as places of worship.” ‘Aisyah added: “If not for that, his grave would have been made visible, but I fear it would be taken as a place of worship.” (Narrated by al-Bukhari)
While the hadith contains a strong warning, its context is crucial. The prohibition does not concern the mere presence of graves. Rather, it addresses the act of turning graves into centers of worship, which may lead to veneration or even idolatry. This concern is reinforced in another narration:
أُولَئِكَ إِذَا مَاتَ مِنْهُمُ الرَّجُلُ الصَّالِحُ بَنَوْا عَلَى قَبْرِهِ مَسْجِدًا ثُمَّ صَوَّرُوا فِيهِ تِلْكَ الصُّوَرَةَ أُولَئِكَ شِرَارُ الْخَلْقِ عِنْدَ اللَّهِ
(رواه البخاري ومسلم)
“When a righteous person among them died, they built a place of worship over his grave and placed images within it. They are the worst of creation in the sight of God.” (Narrated by al-Bukhari and Muslim)
Thus, the core prohibition lies in elevating graves into objects of devotion or ritual focus, not in their physical existence alone.
Ethical Boundaries and Scholarly Interpretation
Another often-cited hadith states:
لَا تَجْلِسُوا عَلَى الْقُبُورِ وَلَا تُصَلُّوا إِلَيْهَا
(رواه مسلم)
“Do not sit on graves, and do not pray facing them.” (Reported by Muslim)
A similar narration reads:
لَا تُصَلُّوا إِلَى الْقُبُورِ وَلَا تَجْلِسُوا عَلَيْهَا (رواه مسلم)
“Do not pray toward graves, and do not sit on them.”
These hadiths emphasize proper etiquette and respect regarding graves. Many scholars interpret them through the principle of sadd al-dharī‘ah—blocking the means to harm—aimed at preventing excessive reverence toward the deceased.
Therefore, many jurists conclude that the ruling is makruh (discouraged), rather than absolutely forbidden, as long as no elements of veneration or deviant belief are involved.
Importantly, other authentic narrations indicate that the Prophet himself performed prayers in areas associated with graves, particularly funeral prayers. For example:
فَأَمَّهُمْ وَصَلَّوْا خَلْفَهُ.
(رواه البخاري)
“He led them in prayer, and they prayed behind him.” (Narrated by al-Bukhari)
And:
أَنَّ النَّبِيَّ صَلَّى عَلَى قَبْرٍ بَعْدَ مَا دُفِنَ فَكَبَّرَ عَلَيْهِ أَرْبَعًا.
(رواه مسلم)
“The Prophet prayed over a قبر after the burial, pronouncing four takbirs.” (Reported by Muslim)
These reports show that the presence of graves does not categorically invalidate prayer. What matters instead is intention, direction, and purpose.
Preserving Monotheism Without Rigidity
Taken together, these sources suggest that Islam strongly safeguards the purity of monotheism by closing avenues that may lead to idolatry. At the same time, it does not impose rigid prohibitions without contextual consideration.
As long as prayer is directed solely to God, not oriented toward graves, and free from any belief that glorifies the deceased, the mere presence of graves—even behind a mosque—does not render the prayer invalid or prohibited.
This balanced view reflects a broader legal and theological principle: preventing harm while maintaining flexibility where the core objectives of worship remain intact.
Reference:
Council For Religious Opinion and Reform, Central Board of Muhammadiyah, Fatwa on Graves Behind Mosques and Sutrah, 2005.
Translator: Bintang Adrian








