“One of the Prophets was bitten by an ant, so he ordered that the ant colony be burned. Then Allah revealed to him: ‘Because one ant bit you, you destroy one of the nations that glorify Allah?’”

Another chain reports a similar hadith.
Sunan Ibn Majah Book 28, Hadith 26