Sahih Muslim , Book 26, Hadith 5567 (USC-MSA)

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."

حَدَّثَنِي أَبُو الطَّاهِرِ، وَحَرْمَلَةُ بْنُ يَحْيَى، قَالاَ أَخْبَرَنَا ابْنُ وَهْبٍ، أَخْبَرَنِي يُونُسُ، عَنِ ابْنِ شِهَابٍ، عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ، وَأَبِي، سَلَمَةَ بْنِ عَبْدِ الرَّحْمَنِ عَنْ أَبِي هُرَيْرَةَ، عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم ‏ "‏ أَنَّ نَمْلَةً قَرَصَتْ نَبِيًّا مِنَ الأَنْبِيَاءِ فَأَمَرَ بِقَرْيَةِ النَّمْلِ فَأُحْرِقَتْ فَأَوْحَى اللَّهُ إِلَيْهِ أَفِي أَنْ قَرَصَتْكَ نَمْلَةٌ أَهْلَكْتَ أُمَّةً مِنَ الأُمَمِ تُسَبِّحُ ‏" ‏ ‏.‏

sunnah.com