of its being to the right or to the left. If the grave is located behind the worshipper, the disapproval is lighter than all of that, though it is still deemed objectionable.
Al-Ḥāfiẓ Ibn Ḥajar in Fatḥ al-Bārī and al-ʿAynī in ʿUmdat al-Qārī both remark: “When a grave lies inside a mosque on the qiblah side, the level of disapproval increases.”
This, in fact, is the sound position on the question, exactly as al-Hindi detailed, for the underlying reason is the resemblance to the Jews and Christians who pray in houses of worship built over graves. That resemblance exists in every scenario already listed, as is obvious. All of this applies to one who happens to pray there without seeking the place deliberately. As for the person who intentionally chooses to pray at such a site, listen to what the jurist Ibn Ḥajar al-Haytamī transmits in al-Zawājir:
“Some Ḥanbalī scholars said: ‘A man who intends to pray at a grave, seeking blessings from it, is in open defiance of Allah and His Messenger and is innovating a form of worship that Allah has not authorised. The practice is forbidden by textual evidence and by unanimous agreement. The gravest of prohibitions and the chief causes of shirk are: praying at graves, taking them as places of worship, and erecting structures over them. Any opinion that describes the matter as merely disliked pertains to cases other than this, for it is inconceivable that scholars would permit an act about which authentic reports from the Prophet (peace and blessings be upon him) declare the doer to be cursed. One must hasten to demolish such buildings and the domes raised over graves, for they are more harmful than the Mosque of Dhirar: they were established in disobedience to the Messenger of Allah, who forbade this practice and commanded that elevated graves be levelled.’ ”
Furthermore, the aforementioned hadiths also prove the prohibition of building mosques over graves. We have addressed that separate issue in al-Taʿlīqāt al-Jiyād, where we cited the various scholarly opinions.