When any of you enters the mosque, let him send peace upon the Prophet and say: Allāhumma iftahli abwāba rahmatik (O Allah, open for me the gates of Your mercy)
Abu Hurayrah (may Allah be pleased with him) reported that the Messenger of Allah (ﷺ) said:
"When any of you enters the mosque, let him send peace upon the Prophet and say: Allāhumma iftahli abwāba rahmatik (O Allah, open for me the gates of Your mercy). And when he leaves, let him send peace upon the Prophet and say: Allāhumma i‘simni min ash-shaytān ar-rajīm (O Allah, protect me from the accursed devil)." In another narration by Al-Hākim: "When he leaves, let him send peace upon the Prophet (ﷺ) and say: Allāhumma ajirni min ash-shaytān ar-rajīm (O Allah, save me from the accursed devil)."
«إِذَا دَخَلَ أَحَدُكُمْ المَسْجِدَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ وَلْيَقُلْ: اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ، وَإِذَا خَرَجَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ وَلْيَقُلْ: اللَّهُمَّ اعْصِمْنِي مِنْ الشَّيْطَانِ الرَّجِيمِ»، وَلِلْحَاكِمِ: «وَإِذَا خَرَجَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ وَلْيَقُلْ: اللَّهُمَّ أَجِرْنِي مِنَ الشَّيْطَانِ الرَّجِيمِ».
The Prophet (ﷺ) guided the Muslim, when entering the mosque, to send peace and blessings upon the Prophet (ﷺ) by saying: Allāhumma salli wa sallim ‘ala Muhammad (O Allah, send Your blessings and peace upon Muhammad), and then to say: Allāhumma iftahli abwāba rahmatik (O Allah, open for me the gates of Your mercy). And when he leaves, he should send peace upon the Prophet and say: Allāhumma i‘simni min ash-shaytān ar-rajīm (O Allah, protect me from the accursed devil). In another narration by Al-Hākim: And say: Allāhumma ajirni min ash-shaytān ar-rajīm (O Allah, save me from the accursed devil).
It is recommended to say this supplication upon entering the mosque and upon leaving it.
This supplication is to be generally recited in all mosques, including the Sacred Mosque.
The specific mention of mercy when entering and seeking protection from the devil when exiting: The one entering is engaged in what brings him closer to Allah and His Paradise, so it is fitting to mention mercy. When exiting, he ventures into the world with its distractions and preoccupations, so it is appropriate to ask Allah for protection and preservation from the devil.
Sunan Ibn Mājah (1/ 494) (773).
More (4)
المستدرك على الصحيحين للحاكم (1/ 325).
شرح أبي داود للعيني (2/ 374).
شرح سنن أبي داود للعباد (66/ 3).
مرشد ذوي الحجا والحاجة إلى سنن ابن ماجه والقول المكتفى على سنن المصطفى (5/ 297).
Cited in books
7 Books- Hisn Al-Muslim (Fortress of the Muslim) Supplications from the Qur’an and Sunnahحصن المسلم"O Allah, open for me the doors of Your mercy"[41].
- Hisn Al-Muslim (Fortress of the Muslim) Supplications from the Qur’an and Sunnahحصن المسلمAllāhumma iftah li abwāba rahmatik
- Hisn Al-Muslim (Fortress of the Muslim) Supplications from the Qur’an and Sunnahحصن المسلمO Allah, protect me from the accursed devil.” [43]
- Hisn Al-Muslim (Fortress of the Muslim) Supplications from the Qur’an and Sunnahحصن المسلمAllāhumma i‘simni min ash-shaytān-ir-rajīm
- رسالة في الأذكار1«إِذَا دَخَلَ أَحَدُكُمُ المَسْجِدَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ صلى الله عليه وسلم ثُمَّ لْيَقُلْ...». وذَكَرَه.
More (2)
- الذكر والدعاء والعلاج بالرقي من الكتاب والسنة"إذا دخل أحدكم المسجد فليسلم على النبي - صلى الله عليه وسلم - وليقل: اللهم افتح لي أبواب رحمتك، وإذا خرج فليسلم على النبي - صلى الله عليه وسلم - وليقل اللهم اعصمني من الشيطان الرجيم" .
- تحفة الأخيار تحفة الأخيار (ببيان جملة نافعة مما ورد في الكتاب والسنة من الأدعية والأذكار)«إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ، فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ، وَلْيَقُلْ: اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ، وَإِذَا خَرَجَ، فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ، وَلْيَقُلْ: اللَّهُمَّ اعْصِمْنِي مِنَ الشَّيْطَانِ الرَّجِيم