Is it permissible to pray in mosques that have graves?
Is it permissible to pray on graves? What is the ruling of praying in mosques that have graves in them? Is this considered taking graves as masajid?
The issue of mosques that have graves in them is a [secondary] question of jurisprudence that has been used in the worst of ways by the ignorant and those who wish to sew discord. They have made it a cause for division among Muslims and their hurling insults at each other. You see some of them insulting others calling them grave worshipers, innovators, and idolaters. There is no ability or power except with God. We gather the scattered bits of words concerning this question in the hopes that God will open blind eyes and deaf ears with them.
There is confusion between separate things that has caused misunderstanding when dealing with this question and has made the situation such that every time we come to discuss it we don't get anywhere. We will clarify these things here and differentiate between them. Prayer on a grave is not the same as praying in a mosque that has a grave in it, and that is not making a grave a masjid. So we will differentiate between three things:
1) Praying on graves.
2) Praying in mosques that have graves in them.
3) Making graves masajid.
Firstly, praying on graves. A grave is the place where a person is buried. Graves are respected in Islamic law as a way of honoring the dead. For this reason the jurists have agreed that it is disliked to walk on graves due to the hadith, "The Prophet forbade walking over graves." But the Malikis considered this particular to graves that are raised mounds, and the Shafi'is and Hanbalis made exceptions from the dislike for walking over a grave out of need and walking over a grave if it is the only way to reach another grave.
As for praying in cemeteries, the Hanafis adopted the position that it is disliked, and this was also the position of al-Thawri and al-Awza'i, due to the fact that it is likely to be filthy, and because it is similar to [the actions of] the Jews, however if there is a place in the cemetery dedicated for prayer, in which there is no grave and no filth then it is alright.
The Malikis said it is permissible to pray in cemeteries regardless of whether they are being used or not, whether they are open or not, or Muslim cemeteries or those of polytheists.
The Shafi'is went into detail saying that it is agreed within the school that prayers performed in cemeteries that are exposed are invalid because the earth has mixed with the remains of the dead. This ruling applies if you do not put something under yourself, but if you do put something under yourself the prayer is disliked. If, however, it is ascertained that it is not exposed, then the prayer is valid without disagreement since the place where the prayer occurred was pure, but it is lightly disliked because it is a place where filth is buried.
If there is doubt concerning its being exposed, there are two positions. The most correct of them is that the prayer is valid but disliked because the basis is that earth is pure so you cannot rule that it is filthy based on doubt. The position that is juxtaposed to the most correct position (muqabil al-asah) is that the prayer is invalid because the basis is that the obligatory prayer is incumbent upon him, and he doubts that it has been fulfilled, and that which is obligatory is not removed by doubt.
The Hanbalis say prayer is not valid in a cemetery regardless of whether it is old or new, whether it has been exposed or not, but there is nothing to prevent praying where there is one or two graves, because that is not called a cemetery; a cemetery is three graves or more. It has been related that their position is that you cannot pray in anything that falls under the name cemetery that surrounds the graves. They unequivocally stated that it is not forbidden to pray in a home in which someone is buried even if it is more than three graves, because that is not cemetery.
This is concerning the jurists' discourse on the question of praying in cemeteries without getting into the question of praying in a mosque that is surrounded by graves.
Secondly: Praying in a mosque that has a grave in it.
Praying in a mosque that houses the grave of one of the prophets or the righteous is valid and legislated, and it can even reach the degree of being recommended. There is evidence for this ruling in the Quran, the Prophetic Sunna, the actions of the Companions, and the consensus of the community in their actions.
From the Quran there is They said: Build over them a building; their Lord knows best concerning them. Those who won their point said: We verily shall build a place of worship over them [18:21]. The evidentiary aspect of this verse is that it refers to the story of the people of the cave. When they were found some people said, "Let's build a structure over them," and others said, "We verily shall build a place of worship over them." The context of the verse indicates that the first statement was made by the polytheists, and the second statement was made by the monotheists. The verse expresses both statements without any disapproval, while if there was something false in them it would have been appropriate for the verse to indicate it in some way.
The verse’s acknowledgement of both of these statements is evidence of the shari'ah's approval of them both. In fact, it presented the statement of the monotheists in a context that indicates praise in light of its being compared with the statement of the polytheists which is enveloped in misgivings, whereas the statement of the monotheists is decisive, We verily shall build, and springs from a vision of faith. They do not seek just to build, they seek to build a place of worship (masjid). This statement indicates that those people knew God and acknowledged worship and prayer.
In his commentary on We verily shall build a place of worship over them, al-Razi said, "In which to worship God and preserve the remnants of the people of the cave.”
Al-Shawkani said, "The mention of building a mosque gives the impression that 'Those who won their point,' are Muslims. But is has been said that they are the people of the kings and sultans of the people mentioned, for they are those who win their point over others, and the first [interpretation] is better. Al-Zajaji said, 'This indicates that when their matter was made apparent, the believers triumphed through bringing forth and resurrection because mosques are for believers. This is what has been mentioned in the Quran in regards to the question of building mosques on graves.
From the Sunna there is the hadith about Abu Nusayr narrated by 'Abd al-Razaq according to Ma'mar, according to Muhammad ibn Muslim ibn Shihab al-Zuhri, according to al-Muwawir ibn Makhramah and Marwan ibn al-Hakam who said, "Abu Basir escaped from the polytheists after the treaty of Hudaybiyyah. He went to the seashore and Abu Jandal ibn Suhayl ibn 'Amr joined him having escaped from the polytheists as well. They were joined by other Muslims whose number reached three-hundred. Abu Basir would lead them in prayer and say, "God Most High is the Greatest, whoever defends [yansur] God is defended by God."
When Abu Jandal joined them he led the prayers. Not a single caravan of Quraysh passed them except they took it and killed those who were with it. Quraysh sent to the Prophet beseeching him for the sake of God and his relatives so send to them [Abu Basir and the others] and that if any of them returned to him they would be safe. The Prophet wrote to Abu Jandal and Abu Basir telling them and those with them to return to their homes and families. The Prophet's letter was brought to Abu Jandal when Abu Basir was on his death-bed. He died with the Prophet's letter in his hand as he was reading it. Abu Jandal buried him in that very place and built a mosque over his grave."
As for the actions of the companions [of the Prophet], it is made clear in the burial of the Prophet and their differences concerning it. This is what Imam Malik related when he mentioned the differences between the companions about where the Prophet should be buried. He said, "Some people said he should be buried by the minbar, others sad he should be buried in the baqi'. Abu Bakr arrived and said, "I heard the Messenger of God say, 'No Prophet has been buried except where they died,' so dig a hole for him there." The evidentiary aspect of this is that the companions of the Messenger of God suggested that he be buried by the minbar which is with all certainty inside the mosque, and nobody rebuked them for this suggestion. Abu Bakr objected to this suggestion not because it would have been impermissible to bury him inside the mosque, but in adherence to his command to be buried in the place where his blessed spirit was taken.
When we consider the prophet’s burial place, we find that his spirit was taken in Aishah's room.
This room was attached to the mosque where the Muslims prayed, so the situation of the room in relation to the mosque was pretty much the same as the situation of mosques that are connected to rooms in which saints are buried in our times when the tomb is connected to the mosque and people pray in the main prayer area of the mosque outside.
There are those who object to this saying it is particular to the Prophet. The response to this is that the particularities of rulings related to the Prophet requires evidence, and the basis is that rulings are general as long as there is no evidence affirming their particularity, and there is no evidence [for this in this case] so the claimed particularity in this case is invalidated. If we accepted the position that this is a particularity of the Prophet (which we have already shown it is not) the answer would be that Abu Bakr and Umar after him were buried in this room, and the room is connected to the mosque, so has the particularity been passed on to Abu Bakr and 'Umar? The companions prayed in the mosque connected to this room that housed three graves, and Aishah lived in the room and prayed her obligatory and supererogatory prayers in it. Is this not to be considered the actions and practical consensus of the companions?
Thirdly: Turning a grave into a masjid is not the same as a mosque that has a grave in it. The turning of graves into masjids has been forbidden by the Prophet and this is different than the building of a mosque in the vicinity of a grave whether they are connected to each other or separated. Aishah related that the Prophet said, "God cursed the Jews and Christians [for] they made masjids of the graves of their prophets." In a version narrated by Muslim it has the addition "the graves of their prophets and righteous." The scholars of the community did not understand from this hadith that the intention is forbidding having mosques connected to the grave of a prophet or righteous person, they interpreted the turning of a grave into a masjid correctly as referring to turning the grave itself into a place upon which to make prostration (sujud) so that people would prostrate on it in worship of the person in the grave as the Jews and Christians did.
The Qur'an says, They have taken as lords beside God their rabbis and their monks and the Messiah son of Mary, when they were bidden to worship only One God. There is no God save Him. Be He Glorified from all that they ascribe as partner (unto Him)! [9:31]
Muslims need to understand what exactly it is that is being forbidden and not look at what Muslim have done in their mosques and claim that the hadith refers to Muslims. This is what the Khawarij did, may God protect us. Ibn 'Umar said, "They took verses [of the Qur'an] that were revealed in reference to polytheists, and applied them to Muslims." No churches or synagogues exist that are like mosques that contain graves to which some people persist in claiming this hadith refers.
The scholars understood the meaning [of these hadiths] with penetrating insight, which becomes clear in their commentaries on them. Shaykh al-Sindi says, concerning this hadith, "What he meant by this is to warn the community about doing to his grave that which the Jews and Christians did with the graves of their prophets, which is to turn them into masjids either by prostrating to them as a form of aggrandizement, or making them a qiblah towards which to turn in prayer. It has been said that the mere building of a mosque in proximity to a righteous person thereby seeking blessings is not forbidden."
Ibn Hajar al-'Asqalani and other commentators on the books of the sunna, related the saying of al-Baydawi who said, "Since the Jews would prostrate to the graves of their prophets in aggrandizement of their status, and make them a qiblah to which they turned in prayer thereby making them idols, God cursed them and prevented and forbade the Muslims from doing similarly.
As for building a mosque in the proximity of a righteous person, or praying by his grave thereby seeking assistance from his spirit and for some of the effects of his worship to reach him, not out of aggrandizement of him for facing him [in prayer], then there is nothing wrong with this. Do you not see that the burial place of Ismail is in the mosque in Mecca? And that mosque is the best mosque in which one can choose to pray. And the prohibition of praying in graveyards refers to those that are uncovered due to the filth that is there."
Al-Mubarkafuri related the saying of al-Tawrabishati in his commentary on the Jami' of Imam al-Tirmidhi, "Al-Tawrabishati said it is excluded in two manners: the first is that they [i.e. the Jews and the Christians] used to prostrate to the graves of their prophets in aggrandizement of them and thereby intending worship. The second is that they were intent on praying in the burial places of their prophets and facing their graves when they were praying and worshipping God. They considered this act the best place with God since it consisted of those two matters."
Based on the preceding, the ruling of praying in mosques in which there are graves is correct if the grave is in a place where people do not pray separate from the mosque, and there is nothing impermissible or disliked about praying in the adjacent mosque. If, however, the grave is inside the mosque itself the prayer is invalid and forbidden according to the school of Ahmed ibn Hanbal, and permitted and correct according to the other three Imams; all that they said is that it is disliked for the grave to be in front of the one in prayer due to the similarity between that and praying to it. And God is Most High and knows best.