Ruling on Sleeping in the Mosque — In Light of Aḥādīth and Statements of the Companions
Excerpt from: Aḥkām al-Masājid by Shaykh Muḥammad Munīr Qamar
❖ Evidence of Sleeping in the Mosque
➊ The case of Aṣḥāb al-Ṣuffah (RA) shows that they resided in the mosque, which proves the permissibility of sleeping there.
➋ The ḥadīth mentioning tents set up in the mosque for Saʿd ibn ʿUbādah (RA) and for the pious woman who used to clean the mosque also indicate the same.
➌ The people of ʿUkal and ʿUraynah, who later stayed with Aṣḥāb al-Ṣuffah, also lived and slept in the mosque.
➍ In Ṣaḥīḥ al-Bukhārī, Abū Dāwūd, Tirmidhī, Nasāʾī, Ibn Mājah, Ibn Ḥibbān, al-Bayhaqī, and Musnad Aḥmad, it is reported from ʿAbdullāh ibn ʿUmar (RA):
((إنه كان ينام وهو شاب أعزب لا أهل له فى مسجد النبى صلى الله عليه وسلم))
Ṣaḥīḥ al-Bukhārī 1/535, Ṣaḥīḥ Abī Dāwūd 368, Musnad Aḥmad 2/70
“When he was young and unmarried, he used to sleep in the mosque of the Prophet ﷺ.”
Another narration in Musnad Aḥmad states:
((كنا فى زمن رسول الله صلى الله عليه وسلم ننام فى المسجد ونقيل فيه ونحن شاب))
“In the time of the Messenger of Allah ﷺ, we used to sleep and rest (day and night) in the mosque, and we were young.”
➎ In Ṣaḥīḥ al-Bukhārī and other sources, it is narrated that when ʿAlī ibn Abī Ṭālib (RA) became upset with Fāṭimah (RA), he went to the mosque and slept there. The Prophet ﷺ found him with dust on his body and affectionately said:
((قم يا أبا تراب، قم يا أبا تراب))
“Get up, O Abū Turāb! Get up, O Abū Turāb!”
This also shows the allowance of sleeping in the mosque when necessary.
❖ Scholarly Commentary
Hāfiẓ Ibn Ḥajar in Fatḥ al-Bārī explained that one may differentiate between daytime rest (qaylūlah) and night sleep. Since clear evidence for regular overnight sleeping is limited, some scholars viewed it with caution.
- The majority of scholars (jumhūr): Consider sleeping in the mosque permissible when needed.
- Ibn ʿAbbās (RA): Held it disliked, except if someone came for prayer and then also slept. He said:
((لا تتخذوه بيتا ومقيلا))
“Do not make the mosque a house or a place of rest (for sleep).” (Sharḥ al-Sunnah 2/739) - Ibn Masʿūd (RA): Considered sleeping in the mosque disliked in general.
- Imām Mālik (RA): Said that if a person has a home, sleeping in the mosque is disliked; but if one has no home, it is permitted.
❖ Conclusion
◈ Sleeping in the mosque is allowed in cases of need, such as for travelers, students of knowledge, or those with no shelter.
◈ It is not meant to turn mosques into residences for those who already have homes.
◈ Respect and sanctity of the mosque must always be preserved.