that falls outside the limits set by the Sacred Law; therefore it is prohibited as a precaution and to block the means that lead to polytheism—especially since the evils connected to mosques built over graves are plain for all to see, as has been noted repeatedly. The scholars have stated both of these rationales.
Al-ʿAllāmah Ibn al-Malik, one of the Ḥanafī jurists, said:
“The reason building mosques upon graves was forbidden is that praying in them constitutes imitation of the Jews.”
Shaykh al-Qārī transmitted this in al-Mirqāt (1/470) and endorsed it. A number of later scholars, Ḥanafīs and others, have said the same, as will be mentioned.
Shaykh al-Islām Ibn Taymiyyah wrote in al-Qāʿidah al-Jalīlah (p. 22):
“To designate a place as a mosque is to set it apart for the five daily prayers and the like, just as mosques are built for that purpose. A place made into a mosque is intended solely for the worship of Allah and supplicating Him, not for supplicating created beings. Hence the Prophet ﷺ forbade turning their graves into mosques to which people deliberately go to perform the prayers, just as they…"