Sayyiduna Abu Hurayrah (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) said: "One of the prophets camped beneath a tree, and an ant bit him. He ordered his baggage, and it was taken out from under it (the tree); then he gave orders about it (the ants' nest), and it was burned in fire. Allah Almighty revealed to him: 'Why did you not punish just the one ant?'" [Sahih: Muslim: 2241]
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحج / 10069