كتاب الجهاد والسير
32  
The Book of Jihad and Expeditions
(46)
Chapter: The words of Allah, the Most High: "And He it is who has withheld their hands from you"
(46)
باب قَوْلِ اللَّهِ تَعَالَى: {وَهُوَ الَّذِي كَفَّ أَيْدِيَهُمْ عَنْكُمْ} الآيَةَ:
Sahih Muslim 1808

It has been narrated on the authority of Anas b. Malik that eighty Persons from the inhabitants of Mecca swooped down upon the Messenger of Allah (ﷺ) from the mountain of Tan'im. They were armed and wanted to attack the Prophet (ﷺ) and his Companions unawares. He (the Holy Prophet) captured them but spared their lives. So, God, the Exalted and Glorious, revealed the verses:

" It is He Who restrained your hands from them and their hands from you in the valley of Mecca after He had given you a victory over them."
حَدَّثَنِي عَمْرُو بْنُ مُحَمَّدٍ النَّاقِدُ، حَدَّثَنَا يَزِيدُ بْنُ هَارُونَ، أَخْبَرَنَا حَمَّادُ بْنُ سَلَمَةَ، عَنْ ثَابِتٍ، عَنْ أَنَسِ بْنِ مَالِكٍ، أَنَّ ثَمَانِينَ، رَجُلاً مِنْ أَهْلِ مَكَّةَ هَبَطُوا عَلَى رَسُولِ اللَّهِ صلى الله عليه وسلم مِنْ جَبَلِ التَّنْعِيمِ مُتَسَلِّحِينَ يُرِيدُونَ غِرَّةَ النَّبِيِّ صلى الله عليه وسلم وَأَصْحَابِهِ فَأَخَذَهُمْ سَلَمًا فَاسْتَحْيَاهُمْ فَأَنْزَلَ اللَّهُ عَزَّ وَجَلَّ ‏{‏ وَهُوَ الَّذِي كَفَّ أَيْدِيَهُمْ عَنْكُمْ وَأَيْدِيَكُمْ عَنْهُمْ بِبَطْنِ مَكَّةَ مِنْ بَعْدِ أَنْ أَظْفَرَكُمْ عَلَيْهِمْ‏}
Reference : Sahih Muslim 1808
In-book reference : Book 32, Hadith 162
USC-MSA web (English) reference : Book 19, Hadith 4452
  (deprecated numbering scheme)