Ref. No. 2648/45-4227
In the name of Allah the most Gracious the most Merciful
The answer to your question is as follows:
It is not allowable to run a Madrasa or Maktab in a masjid or in its basement without the permission and consultation of the masjid management, and that is the reason why this dispute is happening, so the rector of the madrasa should first get permission from the masjid committee and then run the madrasa or maktab in the premises of Masjid.
And Allah knows best
Darul Ifta
Darul Uloom Waqf Deoband