Staying in the Mosque and Using the Fan
Question
Who may stay in the mosque? Likewise, is it permissible or impermissible to use electricity by running a fan inside the mosque all night? Likewise, until which part of the night is running and using the electricity and fans inside the mosque established by the masʾala (Sharʿi ruling)?
Answer
One who is in iʿtikaf (staying in the mosque with the intention of worship), or a traveller who has no lodging anywhere, is permitted to stay in the mosque; and one who stays in the mosque for the sake of being careful about the Tahajjud and Fajr prayers is also permitted. But one should not make the mosque a resting place for oneself.
Source: Fatawa Mahmudiyya
Preview. The full text opens with JavaScript enabled.