Hadith 227

حَدَّثَنَا أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ ، حَدَّثَنَا حَاتِمُ بْنُ إِسْمَاعِيل ، عَنْ حُمَيْدِ بْنِ صَخْرٍ ، عَنْ الْمَقْبُرِيِّ ، عَنْ أَبِي هُرَيْرَةَ ، قَالَ : سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ : " مَنْ جَاءَ مَسْجِدِي هَذَا ، لَمْ يَأْتِهِ إِلَّا لِخَيْرٍ يَتَعَلَّمُهُ ، أَوْ يُعَلِّمُهُ ، فَهُوَ بِمَنْزِلَةِ الْمُجَاهِدِ فِي سَبِيلِ اللَّهِ ، وَمَنْ جَاءَ لِغَيْرِ ذَلِكَ ، فَهُوَ بِمَنْزِلَةِ الرَّجُلِ يَنْظُرُ إِلَى مَتَاعِ غَيْرِهِ " .
´It was narrated that Abu Hurairah said:` "I heard the Messenger of Allah say: 'Whoever comes to this mosque of mine, and only comes for a good purpose, such as to learn or to teach, his status is like that of one who fights in Jihad in the cause of Allah. Whoever comes for any other purpose, his status is that of a man who is keeping an eye on other people's property.'"
Hadith Reference سنن ابن ماجه / (أبواب كتاب السنة) / 227
Hadith Grading الألبانی: صحيح  |  زبیر علی زئی: إسناده حسن
Hadith Takhrij «تفرد بہ ابن ماجہ ، ( تحفة الأشراف : 12956 ، ومصباح الزجاجة : 85 ) ، وقد أخرجہ : مسند احمد ( 2/350 ، 418 ، 526 ) ( صحیح ) »
Explanation & Benefits
Maulana Ataullah Sajid
Commentary:

(1)
The purpose of constructing a mosque is not only the worship of Allah, the One without partner, but also that it serves as a center for the propagation of religion and as an institution for learning and teaching knowledge. The Prophet’s Mosque (Masjid Nabawi) was also a great center of knowledge, in which the Messenger of Allah (sallallahu alayhi wa sallam) would fulfill the duty of teaching the Book and wisdom, as well as the training and purification of the soul. Therefore, when a Muslim comes to the mosque, his intention should be to attain these lofty objectives; only then will he be able to truly benefit from the blessed environment of the mosque.

(2)
Unnecessary talk and quarrelling in the mosque are contrary to the etiquette of the mosque, and such actions affect the sanctity of the mosque. Thus, the one who engages in such behavior is not only deprived of the blessings of the mosque but is also counted among the sinners.

(3)
The process of teaching and learning religious sciences is also a type of jihad, because the purpose of fighting in the way of Allah (qital fi sabilillah) is to bring people out of the misguidance of disbelief and enable them to benefit from the light of Islam. Therefore, if centers of knowledge and education do not exist, it will become difficult to teach Islam to non-Muslims and new Muslims, and the very objective of jihad will be lost.

(4)
The person who comes to the mosque neither for worship and remembrance of Allah, nor for learning or teaching knowledge, has gained nothing—just as a person who goes to the market but neither buys nor sells anything, does not obtain any worldly benefit. The goods lying in the market are not his; merely looking at them does not fulfill any of his needs. He returns from the market without obtaining any worldly benefit. Similarly, the one who sits in the mosque without purpose is deprived of religious benefits.
Source: Commentary on Sunan Ibn Mājah by Mawlānā ‘Atā’ullāh Sājid, Page: 227