What is the ruling on offering Salaah in a Masjid where there is a grave?

Question 318: If there is a grave in the backyard of a Masjid (mosque) with a wall in between, is it permissible to perform Salaah in that Masjid? Is performing Salaah there valid or not? What is the legal ruling on a person who swears by other than Allaah such as the Prophet or Al-Amaanah (Honesty)?

Answer: It is invalid to offer Salaah in any Masjid where there is a grave. The Prophet (peace be upon him) is quoted to have prohibited to take graves as Masjids. The prohibition indicates that it is not permissible to perform Salaah there whether a building was established upon it or not, or if the grave is attached and connected directly to the Masjid or the Masjid is built for its sake. However, in case the Masjid is separated from the grave with a street or a passage for example, there will be no harm to pray therein. It is not permissible to swear by other than Allaah (Glorified be He), neither by the Prophet (peace be upon him) or anyone else because the Prophet stated: Anyone who swears by other than Allaah has committed a disbelief or has associated others with Allaah.... read more here.

Ruling on building a Masjid over a grave

Question 317: Is it permissible to build a Masjid (mosque) over a grave out of necessity? Is it permissible to build a Masjid in the graveyard after exhuming the bodies? Is it permissible to install pillars in the grave, while leaving the first floor empty and building the Masjid on the second floor?

Answer: It is not permissible to build a Masjid over graves or exhume the dead to raise a Masjid in their places. The graves have a greater right to the site where they were built, and Muslims must look for another place to build the Masjid. Similarly, it is not permissible to install pillars in the graves or build over them, whether the building is a Masjid or whatsoever. Masjids are not to be built over graves, and the dead must not be disturbed. Furthermore, performing prayers in such Masjids leads people to associate its dwellers as partners with Allaah and exaggerate their status. Therefore, it was authentically reported from Allaah’s Messenger (peace be upon him) that he stated... read more here.

Installing pillars over graves and building over them

Question 316: Is it permissible to build a Masjid (mosque) over a grave out of necessity? Is it permissible to build a Masjid in the graveyard after exhuming the bodies? Is it permissible to install pillars in the grave, while leaving the first floor empty and building the Masjid on the second floor?

Answer: It is not permissible to build a Masjid over graves or exhume the dead to raise a Masjid in their places. The graves have a greater right to the site where they were built, and Muslims must look for another place to build the Masjid. Similarly, it is not permissible to install pillars in the graves or build over them, whether the building is a Masjid or whatsoever. Masjids are not to be built over graves, and the dead must not be disturbed. Furthermore, performing prayers in such Masjids leads people to associate its dwellers as partners with Allaah and exaggerate their status. Therefore, it was authentically reported from Allaah’s Messenger (peace be upon him) that he stated... read more here.

Building a room over the graves of the Awliyaa’ for offering Salaah?

Question 315: In Yemen large graves were built for some Awliyaa’ (pious people) and rooms were built over these graves with domes like those of Masjids (Mosque) attached over them. These Masjid-like rooms are dedicated by people for offering Salaah (Prayer). What is the ruling on that?

Answer: It is not permissible to build Masjids over graves, because this is a means leading to Shirk (associating others with Allaah in His Divinity or worship). It is even more emphatically prohibited to offer Salaah at the graves, whether in places built over them or not, as the Prophet (peace be upon him) forbade this. It leads to people calling upon the dead, seeking help and blessing from their graves. This is major Shirk which takes a person out of Islaam. Accordingly, it is not permissible to offer Salaah in such places, and rooms built over graves should be demolished, as the Prophet (peace be upon him) instructed `Alee (may Allaah be pleased with him) Leave not a raised grave unleveled.... read more here.