كتاب السلام
39  
The Book of Greetings
(39)
Chapter: The Prohibition Of Killing Ants
(39)
باب النَّهْىِ عَنْ قَتْلِ النَّمْلِ، ‏‏
Sahih Muslim 2241 a

Abu Huraira reported Allah's Messenger (ﷺ) as saying:

An ant had bitten a Prophet (one amongst the earlier Prophets) and he ordered that the colony of the ants should be burnt. And Allah revealed to him:" Because of an ant's bite you have burnt a community from amongst the communities which sings My glory."
حَدَّثَنِي أَبُو الطَّاهِرِ، وَحَرْمَلَةُ بْنُ يَحْيَى، قَالاَ أَخْبَرَنَا ابْنُ وَهْبٍ، أَخْبَرَنِي يُونُسُ، عَنِ ابْنِ شِهَابٍ، عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ، وَأَبِي، سَلَمَةَ بْنِ عَبْدِ الرَّحْمَنِ عَنْ أَبِي هُرَيْرَةَ، عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم ‏ "‏ أَنَّ نَمْلَةً قَرَصَتْ نَبِيًّا مِنَ الأَنْبِيَاءِ فَأَمَرَ بِقَرْيَةِ النَّمْلِ فَأُحْرِقَتْ فَأَوْحَى اللَّهُ إِلَيْهِ أَفِي أَنْ قَرَصَتْكَ نَمْلَةٌ أَهْلَكْتَ أُمَّةً مِنَ الأُمَمِ تُسَبِّحُ ‏"‏ ‏.‏
Reference : Sahih Muslim 2241a
In-book reference : Book 39, Hadith 200
USC-MSA web (English) reference : Book 26, Hadith 5567
  (deprecated numbering scheme)