Placing a grave in the Masjid

Q: Someone built a Masjid (mosque) in Yemen and he made a will that his family should place his grave inside that Masjid. When he died, they buried him in the Masjid in the direction of the Qiblah (direction faced for Prayer towards the Ka‘bah). The distance between the courtyard where his grave lies and the Qiblah is only one meter. Please, guide us concerning this issue.

A: This grave should be dug up and the corpse should be carried to any place far from the Masjid such as the town graveyard. Placing a grave inside the Masjid is a means leading to Shirk (associating others with Allah in His Divinity or worship). If the grave lies in the direction of the Qiblah, the prohibition is more serious and the act is closer to Shirk as it may lead to worshipping the occupant of the grave. This is based on what is related by Al-Bukhari and Muslim in their Two Sahih (authentic) Books of Hadith on the authority of Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (peace be upon him) stated, May Allah curse the Jews and the Christians for they have taken the graves of their prophets as places of worship. Also Muslim related that the Prophet (peace be upon him) stated, Do not sit on graves and do not pray towards them. Moreover, Muslim related that the Prophet (peace be upon him) stated, Beware! Those who came before you used to take the graves of their Prophets and righteous people as places of worship. Do not take graves as places of worship; I forbid you to do that. (Part No. 1; Page No. 424) May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.