Question: Is it permissible to pray in mosques where graves are present? Will the prayer be valid?
Answer: It is advisable to avoid praying in mosques where graves are present.
First, consider some hadiths regarding praying in places with graves or facing graves during prayer:
➊ It is narrated from Sayyida Aisha (may Allah be pleased with her) that Umm Habiba and Umm Salama (may Allah be pleased with them) mentioned to the Prophet Muhammad (peace be upon him) about a church in Abyssinia and the pictures placed in it. The Prophet (peace be upon him) said:
إن اولئك إذا كان فيهم الرجل الصالح فمات، بنوا على قبره مسجدا وصوروا فيه تلك الصور، فاولئك شرار الخلق عند الله يوم القيامة
“Indeed, when a righteous person died among them, they would build a mosque over his grave and paint pictures in it. These people will be the worst creatures before Allah on the Day of Judgment.”
➋ It is narrated from Sayyida Aisha (may Allah be pleased with her) that the Messenger of Allah (peace be upon him) said:
لعن الله اليهود والنصارى، اتخذوا قبور انبيائهم مساجد
“May Allah curse the Jews and Christians who made the graves of their prophets into places of worship.”
➌ It is narrated from Sayyidina Abu Huraira (may Allah be pleased with him) that the Messenger of Allah (peace be upon him) said:
قاتل الله اليهود والنصارى، اتخذوا قبور انبيائهم مساجد
“May Allah destroy the Jews who made the graves of their prophets into mosques.”
➍ It is narrated in a lengthy narration from Sayyidina Jundub (may Allah be pleased with him) that the Messenger of Allah (peace be upon him) said before his passing:
الا وإن من كان قبلكم، كانوا يتخذون قبور انبيائهم وصالحيهم مساجد، الا فلا تتخذوا القبور مساجد، إني انهاكم عن ذلك
“Beware! The people before you (Jews and Christians) used to build mosques over the graves of their prophets and righteous people. Beware! Do not make graves into mosques; I forbid you from this.”
From these hadiths, it is understood that building mosques over graves is religiously forbidden and prohibited, so praying in such mosques is even more forbidden. Understand it by this example: buying and selling alcohol is prohibited. Within this prohibition, drinking alcohol is also forbidden because buying and selling is a means, and the purpose is drinking alcohol. The Islamic principle is that the prohibition of the means includes the prohibition of the intended purpose.
Similarly, building a mosque is the means, and the purpose is to perform prayer. When building mosques over graves is forbidden, then praying inside such mosques will also be considered forbidden. Since Shariah commands building mosques, it also commands praying in them because the purpose of building a mosque is to perform prayer. Therefore, Imam Ibn Hazm (may Allah have mercy on him) narrated from Imam Ahmad (may Allah have mercy on him) that he said:
من صلٰي فى مقبرة او الٰي قبر اعاد ابدا
“Whoever prays in a place with graves or facing a grave must repeat his prayer.”
Sayyidina Abu Marthad Ghannawi (may Allah be pleased with him) reports that he heard the Messenger of Allah (peace be upon him) say:
لا تصلوا الي القبور ولا تجلسوا عليها
“Do not pray facing graves nor sit on them.”
It is narrated from Sayyidina Abu Saeed Khudri (may Allah be pleased with him) that the Messenger of Allah (peace be upon him) said:
الارض كلها مسجد الا المقبرة والحمام
“The whole earth is a mosque except for the places of graves and baths.”
This hadith has been declared authentic by Ibn Khuzaymah, Ibn Hibban, Hakim, and Dhahabi (may Allah have mercy on them). Some scholars have considered it weak, but the correct view is that it has been narrated both as mursal and musnad, and the narrator of the musnad version is trustworthy. When there is a dispute between mursal and musnad, the ruling follows the musnad. Imam Nawawi (may Allah have mercy on him) in his Sharh Muslim specifically quoted Imam Bukhari and Imam Muslim (may Allah have mercy on them) stating that when there is a dispute between mursal and musnad, the ruling follows the musnad.
Similarly, Allama Araqi also stated this.
It is narrated from Sayyidina Anas bin Malik (may Allah be pleased with him):
ان النبى صلى الله عليه وسلم نهيٰ ان يصلي بين القبور
Imam Haithami (may Allah have mercy on him) says that Imam Bazzar narrated it and its narrators are reliable. One supporting narration is from Abdullah bin Amr in Sahih Ibn Hibban.
Another supporting narration is from Hazrat Ali (may Allah be pleased with him) in Abu Dawood 490, Bayhaqi 1451/2, and Talkhis al-Habeer 277/1.
“The Prophet (peace be upon him) forbade praying between graves.”
It is narrated from Sayyidina Abdullah bin Amr (may Allah be pleased with him) that the Messenger of Allah (peace be upon him) said:
اجعلوا فى بيوتكم من صلاتكم، ولا تتخذوها قبورا
“Perform part of your prayer in your homes; do not make them graveyards.”
It is narrated from Sayyidina Abu Huraira (may Allah be pleased with him) that the Messenger of Allah (peace be upon him) said:
لا تجعلوا بيوتكم مقابر، إن الشيطان ينفر من البيت الذى تقرا فيه سورة البقرة
“Do not make your homes graveyards; indeed, Satan flees from the house in which Surah Al-Baqarah is recited.”
From these hadiths, it is understood that praying in places with graves is prohibited, and the hadiths of Ibn Amr and Abu Huraira (may Allah be pleased with them) forbidding making homes graveyards indicate that graves are not places for prayer or Quran recitation. Therefore, do not make your homes like graveyards; rather, perform voluntary prayers at home so that they do not become graveyards.
Imam Suyuti (may Allah have mercy on him) comments in his marginal notes on Nasa’i:
وَلَا تَتَّخِذُوْهَا قُبُوْرًا The meaning of this was mentioned by Imam Karamani (may Allah have mercy on him):
“Do not make them like graves because prayers are not performed in graves.”
At the same place, Allama Sindhi (may Allah have mercy on him) writes:
اي كالقبور فى الخلو عن ذكر الله والصلاة
“Do not make homes like graves where the remembrance of Allah and prayer do not occur.”
These hadiths generally prohibit praying in places with graves, whether the grave is on the right, left, front, or behind, because the prohibition hadith is general, and unless the generality is specified by evidence from the Quran or Sunnah, the general meaning remains.
Imam Ibn Taymiyyah (may Allah have mercy on him) states:
“Neither praying in a place with a grave nor facing a grave is valid, and the reason for this prohibition is to prevent the means of shirk (polytheism). Some of our companions have mentioned that one or two graves do not prevent prayer because they are not called maqbara (a graveyard). Maqbara refers to three or more graves. Imam Ahmad (may Allah have mercy on him) and his general companions do not differentiate; rather, their argument is based on the generality of the cause and reasoning, which prevents praying even near one grave, and this is the correct and true view. Maqbara is any place where a grave is made, not just a collection of graves.”
Our scholars have said that in the environment of graves, any place that comes under the name of maqbara should not be prayed in. This clarifies that the prohibition of prayer includes even one grave.
From the above Quranic and Sunnah evidences and explanations of the scholars and muhaddithin, it is understood that prayer is not valid in places with graves; therefore, avoiding such places is highly necessary.