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.
bukhari:4567Saʿīd b. Abū Maryam > Muḥammad b. Jaʿfar > Zayd b. Aslam > ʿAṭāʾ b. Yasār > Abū Saʿīd al-Khudrī

During the lifetime of Messenger of Allah ﷺ, some men among the hypocrites used to remain behind him (i.e. did not accompany him) when he went out for a Ghazwa and they would be pleased to stay at home behind Messenger of Allah ﷺ When Messenger of Allah ﷺ returned (from the battle) they would put forward (false) excuses and take oaths, wishing to be praised for what they had not done. So there was revealed:-- "Think not that those who rejoice in what they have done, and love to be praised for what they have not done.." (3.188)  

البخاري:٤٥٦٧حَدَّثَنَا سَعِيدُ بْنُ أَبِي مَرْيَمَ أَخْبَرَنَا مُحَمَّدُ بْنُ جَعْفَرٍ قَالَ حَدَّثَنِي زَيْدُ بْنُ أَسْلَمَ عَنْ عَطَاءِ بْنِ يَسَارٍ

عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ ؓ أَنَّ رِجَالاً مِنَ الْمُنَافِقِينَ عَلَى عَهْدِ رَسُولِ اللَّهِ ﷺ كَانَ إِذَا خَرَجَ رَسُولُ اللَّهِ ﷺ إِلَى الْغَزْوِ تَخَلَّفُوا عَنْهُ وَفَرِحُوا بِمَقْعَدِهِمْ خِلاَفَ رَسُولِ اللَّهِ ﷺ فَإِذَا قَدِمَ رَسُولُ اللَّهِ ﷺ اعْتَذَرُوا إِلَيْهِ وَحَلَفُوا وَأَحَبُّوا أَنْ يُحْمَدُوا بِمَا لَمْ يَفْعَلُوا فَنَزَلَتْ {لاَ يَحْسِبَنَّ الَّذِينَ يَفْرَحُونَ} الآيَةَ  


See similar narrations below:

Collected by Muslim, Ibn Ḥibbān
muslim:2777al-Ḥasan b. ʿAlī al-Ḥulwānī And Muḥammad b. Sahl al-Tamīmī > Ibn Abū Maryam > Muḥammad b. Jaʿfar > Zayd b. Aslam > ʿAṭāʾ b. Yasār > Abū Saʿīd al-Khudrī

" Think not that those who exult in what they have done, and love to be praised for what they have not done-think not them to be safe from the chastisement; and for them is a painful chastisement" (iii. 18).  

مسلم:٢٧٧٧حَدَّثَنَا الْحَسَنُ بْنُ عَلِيٍّ الْحُلْوَانِيُّ وَمُحَمَّدُ بْنُ سَهْلٍ التَّمِيمِيُّ قَالاَ حَدَّثَنَا ابْنُ أَبِي مَرْيَمَ أَخْبَرَنَا مُحَمَّدُ بْنُ جَعْفَرٍ أَخْبَرَنِي زَيْدُ بْنُ أَسْلَمَ عَنْ عَطَاءِ بْنِ يَسَارٍ عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ

أَنَّ رِجَالاً مِنَ الْمُنَافِقِينَ فِي عَهْدِ رَسُولِ اللَّهِ ﷺ كَانُوا إِذَا خَرَجَ النَّبِيُّ ﷺ إِلَى الْغَزْوِ تَخَلَّفُوا عَنْهُ وَفَرِحُوا بِمَقْعَدِهِمْ خِلاَفَ رَسُولِ اللَّهِ ﷺ فَإِذَا قَدِمَ النَّبِيُّ ﷺ اعْتَذَرُوا إِلَيْهِ وَحَلَفُوا وَأَحَبُّوا أَنْ يُحْمَدُوا بِمَا لَمْ يَفْعَلُوا فَنَزَلَتْ { لاَ تَحْسَبَنَّ الَّذِينَ يَفْرَحُونَ بِمَا أَتَوْا وَيُحِبُّونَ أَنْ يُحْمَدُوا بِمَا لَمْ يَفْعَلُوا فَلاَ تَحْسَبَنَّهُمْ بِمَفَازَةٍ مِنَ الْعَذَابِ}  

ذِكْرُ السَّبَبِ الَّذِي مِنْ أَجَلِهِ، أَنْزَلَ اللَّهُ {لَا تَحْسَبَنَّ الَّذِينَ يَفْرَحُونَ بِمَا أَتَوْا}

ibnhibban:4732ʿUmar b. Muḥammad al-Hamdānī > Muḥammad b. Sahl b. ʿAskar > Ibn Abū Maryam > Muḥammad b. Jaʿfar b. Abū Kathīr > Zayd b. Aslam > ʿAṭāʾ b. Yasār > Abū Saʿīd al-Khudrī

[Machine] "There were men among the hypocrites during the time of the Messenger of Allah ﷺ who, when the Prophet ﷺ went out for battle, would lag behind and rejoice in their seats, opposing the Messenger of Allah ﷺ . But when the Messenger of Allah ﷺ returned, they would apologize to him, swear oaths, and pretend to love to be praised for what they had not done. Then the verse {Do not think that those who rejoice in what they have perpetrated} was revealed."  

ابن حبّان:٤٧٣٢أَخْبَرَنَا عُمَرُ بْنُ مُحَمَّدٍ الْهَمْدَانِيُّ حَدَّثَنَا مُحَمَّدُ بْنُ سَهْلِ بْنِ عَسْكَرٍ حَدَّثَنَا ابْنُ أَبِي مَرْيَمَ حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرِ بْنِ أَبِي كَثِيرٍ حَدَّثَنَا زَيْدُ بْنُ أَسْلَمَ عَنْ عَطَاءِ بْنِ يَسَارٍ عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ

«أَنَّ رِجَالًا مِنَ الْمُنَافِقِينَ فِي عَهْدِ رَسُولِ اللَّهِ ﷺ كَانَ إِذَا خَرَجَ النَّبِيُّ ﷺ إِلَى الْغَزْوِ وَتَخَلَّفُوا عَنْهُ وَفَرِحُوا بِمَقْعَدِهِمْ خِلَافَ رَسُولِ اللَّهِ ﷺ فَإِذَا قَدِمَ رَسُولُ اللَّهِ ﷺ اعْتَذَرُوا إِلَيْهِ وَحَلَفُوا وَأَحَبُّوا أَنْ يُحْمَدُوا بِمَا لَمْ يَفْعَلُوا فَنَزَلَ {لَا تَحْسَبَنَّ الَّذِينَ يَفْرَحُونَ بِمَا أَتَوْا} »