An Imam Willed That He be Buried in the Qiblah of the Mosque
Question :
There is a congregational mosque which had an Imam and he willed before his death that, when he died, they should bury him facing towards the Qiblah of the mosque. Is this Correct?
Answer:
This bequest is invalid and it is not permissible for him to be buried in the mosque, nor in its Qiblah - so this bequest is invalid and this person must be buried in the cemetery with the (rest of) the people.
As for burial inside the mosques, this was forbidden by the Prophet. He also forbade building mosques over graves, and he cursed those who do so and this was when he was on his deathbed, warning his community, and he mentioned that it was from the deeds of the Jews and Christians, and it leads to the association of partners with Allah, the Almighty, the All- Powerful. This is because building mosques over graveyards and burying the dead therein leads to associating the occupants of these graves as partners with Allah, the Almighty, the All- Powerful. And by doing this, the people think that the inhabitants of graves in the mosques can benefit and harm them, and that they possess special qualities which necessitate that one draw near to them by acts of obedience to other than Allah, Most Glorified, Most High. So it is incumbent upon the Muslims to beware of this gravely serious phenomenon and that the mosques be free of graves, erected upon a foundation of Tawhid and correct beliefs. Allah, Most Glorified, Most High says:
"And the mosques are for Allah (Alone): so invoke not anyone along with Allah."
Therefore, the mosques must be for Allah, Most Glorified, Most High, free from the manifestations of Shirk and acts of worship therein should be for Allah, Alone, without partners. This is what is incumbent upon the Muslims. And Allah is the Granter of success.
Source:
Ibn 'Uthaimin
Fatawa Islamiyah, Vol. 5 Pages 76-77