I heard the Messenger of Allah ﷺ say, "An ant bit one of the prophets, so he ordered the ant colony to be burned, and it was burned. Then Allah revealed to him, 'Because a single ant bit you, you destroyed an entire community that glorifies Me?'"
سمعت رسول الله ﷺ يقول: قرصت نملة نبيا من الأنبياء، فأمر بقرية النمل فأحرقت. فأوحى الله إليه: أن قرصتك نملة أحرقت أمة من الأمم تسبح؟
Bukhari narrated it in jihad (3019), and Muslim narrated it in salutations (2241:148), both of them through Yunus, from Ibn Shihab, from Saeed bin Musayab and Abu Salama, from Abu Hurairah, who said, then he mentioned it.