Hadith on Mosques: The Masjid was only built to remember Allah

Buraydah reported: A man announced loudly in the mosque, saying, “Has anyone seen my red camel?” The Prophet, peace and blessings be upon him, said, “May you not find it! Verily, the mosques were only built for the purpose they were built.

Source: Ṣaḥīḥ Muslim 569

Grade: Sahih (authentic) according to Muslim

Al-Nawawi said, “The mosques were only built for what they were built, meaning, for the remembrance of Allah Almighty, prayer, knowledge, good lessons, and so on.”

Source: Sharḥ al-Nawawī ‘alá Ṣaḥīḥ Muslim 569

عَنْ بُرَيْدَة أَنَّ رَجُلًا نَشَدَ فِي الْمَسْجِدِ فَقَالَ مَنْ دَعَا إِلَى الْجَمَلِ الْأَحْمَرِ فَقَالَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ لَا وَجَدْتَ إِنَّمَا بُنِيَتْ الْمَسَاجِدُ لِمَا بُنِيَتْ لَهُ

569 صحيح مسلم كتاب المساجد ومواضع الصلاة باب النهي عن نشد الضالة في المسجد وما يقوله من سمع الناشد

قال النووي إِنَّمَا بُنِيَتِ الْمَسَاجِدُ لِمَا بُنِيَتْ لَهُ مَعْنَاهُ لِذِكْرِ اللَّهِ تَعَالَى وَالصَّلَاةِ وَالْعِلْمِ وَالْمُذَاكَرَةِ فِي الْخَيْرِ وَنَحْوِهَا

569 شرح النووي على مسلم