Firstly: there is nothing wrong with having the mosque beneath a structure or above it, if it is built in this manner from the outset.
In al-Mawsooâah al-Fiqhiyyah (12/295) it says: The Shaafaâis, Maalikis and Hanbalis regard it as permissible to make the top of the building a mosque but not the bottom, or vice versa, because the two structures are independents units that may be given as waqfs; therefore it is permissible to give one of them as a waqf and not the other. End quote.
The scholars of the Standing Committee for Issuing Fatwas were asked: I have built a house and my intention that was formed before starting to build was to have a mosque beneath the house. The house has been built and the qiblah has been determined, and the washrooms for the mosque have been built. The carpentry work has been completed and there is nothing left but painting; the mosque has been given an Islamic appearance. But I heard from some people that building a mosque under the house is not permissible. I stopped using the house and did not open the mosque for five years until we find out what to do. What is your opinion about building the mosque under the house? Please note that there are other small mosques that have been built in the neighbourhood during this period and there are now numerous small mosques. Please advise me, may Allah reward you with good.
They replied: There is no reason why the mosque cannot be under the house if the mosque and the house were built from the outset in this manner, or if the mosque is created in the structure beneath the house. But if accommodation is built above the mosque at a later date, then this is not permissible because the roof of the mosque and whatever is on it are part of the mosque. End quote.
Fataawa al-Lajnah al-Daaâimah, 5/220, vol 2.
The basic principle is that bequests are to be carried out and not changed so long as they do not involve any sin, because Allah says (interpretation of the meaning): âThen whoever changes the bequest after hearing it, the sin shall be on those who make the change. Truly, Allaah is All-Hearer, All-Knowerâ al-Baqarah 2:181. With regard to changing them to something better, there is a difference of scholarly opinion.
Shaykh Ibn âUthaymeen (may Allah have mercy on him) said: Changing the bequest to something better than it is a matter concerning which the scholars differed.
Some of them said that it is not permissible, because of the general meaning of the words of Allah (interpretation of the meaning): âThen whoever changes the bequest after hearing it, â¦â al-Baqarah 2:181. And no exception is made except in the case where the bequest involves sin; so the matter should be left as it is and not changed.
Some of the scholars said: Rather it is permissible to change it to something better, because the aim of the bequest is to draw close to Allah, may He be glorified and exalted, and to benefit the recipient of the bequest. So whatever brings a person closer to Allah and is more beneficial to the recipient is what should be done. The one who left the bequest is a human being who may not be aware of what is better, and what is better at one particular time may be different from what is better at another time. And because the Prophet (blessings and peace of Allah be upon him) permitted changing vows to something better although it is obligatory to fulfil them.
What I think with regard to this matter is that if the bequest is to a specific person, then it is not permissible to change it, such as if the bequest is to Zayd only, or a waqf that is established to benefit Zayd, then it is not permissible to change it because it is connected to the rights of a specific individual.
But if the bequest is not made to any specific person â such as if it is for mosques or for the poor â there is nothing wrong with changing it for the better.
End quote from Tafseer al-Qurâaan by al-âUthaymeen, 4/256
Based on this, it is permissible to build the mosque on its own and the other facilities separately, or it is permissible to put them all in one building.
And Allah knows best.