Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
malik:9-61Mālik > Suma a freed slave of Abū Bakr

Yahya related to me from Malik from Sumayy, the mawla of Abu Bakr, that Abu Bakr ibn Abd ar-Rahman used to say, "Someone who goes to the mosque in the morning or the afternoon with no intention of going anywhere else, either to learn good or teach it, is like someone who does jihad in the way of Allah and returns with booty."  

مالك:٩-٦١وَحَدَّثَنِي عَنْ مَالِكٍ عَنْ سُمَىٍّ مَوْلَى أَبِي بَكْرٍ

أَنَّ أَبَا بَكْرِ بْنَ عَبْدِ الرَّحْمَنِ كَانَ يَقُولُ مَنْ غَدَا أَوْ رَاحَ إِلَى الْمَسْجِدِ لاَ يُرِيدُ غَيْرَهُ لِيَتَعَلَّمَ خَيْرًا أَوْ لِيُعَلِّمَهُ ثُمَّ رَجَعَ إِلَى بَيْتِهِ كَانَ كَالْمُجَاهِدِ فِي سَبِيلِ اللَّهِ رَجَعَ غَانِمًا