The ant said to the birds, "We all know that to antagonise anyone or to take revenge on him are traits that Allah does not like, more so if it is against a speechless animal like me, an ant." She continued, "Allah has prohibited man to make mischief on the land. And it is detestable to cut down trees and plants and to harm mute animals. On the Day of Resurrection a man will be questioned even about the bird that he killed for no reason. So why should one not be asked about burning an innocent and harmless ant, particularly if the perpetrator is one of those slaves who are close to Allah. Such an act is liable to earn the displeasure of Allah. Our beloved Prophet (ﷺ) has narrated to us the incident of a Prophet burning down a whole colony of ants became the cause of Allah's wrath." The dove said, "Tell us more about it, O my sister!"
The ant said, "lmam Al-Bukhari has transmitted a Hadith narrated by Abu Hurayrah, radhiyallahu 'anhu, the Messenger of Allah (ﷺ) said,
The version in Sahih Muslim as narrated by Abu Hurayra, radhiyallahu 'anhu, is,نَزَلَ نَبِيٌّ مِنَ الأَنْبِيَاءِ تَحْتَ شَجَرَةٍ فَلَدَغَتْهُ نَمْلَةٌ، فَأَمَرَ بِجَهَازِهِ فَأُخْرِجَ مِنْ تَحْتِهَا، ثُمَّ أَمَرَ بِبَيْتِهَا فَأُحْرِقَ بِالنَّارِ، فَأَوْحَى اللَّهُ إِلَيْهِ فَهَلاَّ نَمْلَةً وَاحِدَةً"Once while a prophet amongst the prophets was taking a rest underneath a tree, an ant bit him. He, therefore, ordered that his luggage be taken away from underneath that tree and then ordered that the dwelling place of the ants should be set on fire. Allah sent him a revelation, "Wouldn't it have been sufficient to burn a single ant (that bit you)?"
The Prophets, alaihimassalam, are also human beings like any other man. They have the same human idiosyncrasies as any other man. Like all hunan beings, they are displeased on being hurt and they get angry. This is what happened to the Prophet mentioned in the hadith. Perhaps he was on a journey and had stopped somewhere to rest under a tree. There was a burrow of the ants under the tree for an ant never lives alone but lives in a colony of ants. If anyone disturbs it at its burrow, it bites him and gives vent to its anger.أَنَّ نَمْلَةً قَرَصَتْ نَبِيًّا مِنَ الأَنْبِيَاءِ فَأَمَرَ بِقَرْيَةِ النَّمْلِ فَأُحْرِقَتْ فَأَوْحَى اللَّهُ إِلَيْهِ أَفِي أَنْ قَرَصَتْكَ نَمْلَةٌ أَهْلَكْتَ أُمَّةً مِنَ الأُمَمِ تُسَبِّحُ"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'."
Thus, when the Prophet sat there, he became the target of the ant. He did not like that and decided to punish the ant. He had placed his luggage under the tree which he ordered to be moved away from there and the entire burrow of the ants was burned down. Hundreds of ants were burnt because of that. Allah was displeased with this act of the Prophet and He let him know through revelation that He was angry. "If you had to seek vengeance then you should have punished the one ant that had bitten you. How is it that just because one ant caused you inconvenience you destroyed the whole community that was glorifying Me?" Justice demanded that the innocent should not be punished for the sin of the culprit.
It is also not approved that anyone who glorifies Allah should be killed because, if he is spared, he will go on praising and glorifying Allah as long as he lives.
Besides, this behaviour was not consonant with the character of men of Allah. It is not allowed to kill an inocent person against the sin committed by someone else. Only he should be punished who has committed the crime. Allah showed His displeasure to His Prophet by saying, "Why did you not kill only one ant? What was the wisdom in taking revenge from all of them?"
It is not allowed to kill ants unnecessarily. However, if an ant bites anyone, then he may kill it but it is wrong to harm it without any reason. The same applies to other harmless and innocent animals.
Jabir bin ‘Abdullah, radhiyallahu 'anhu, said, "The Messenger of Allah (ﷺ) forbade killing any animal when it is tied up (for use as a target).” - [Sunan Ibn Majah; Sahih].
Reference :Narrated Abdullah ibn Abbas, radhiyallahu 'anhu, that the Prophet (ﷺ) prohibited to kill four creatures: ants, bees, hoopoes, and sparrow-hawks. - [Sunan Abi Dawud; Sahih by Al-Albani]Nevertheless, it is allowed to kill the harmful creatures like snakes, scorpions, etc. In a Hadith, five animals are mentioned whom it is allowed to kill within and outside the Haram. Narrated Aisha, radhiyallahu 'anha, that Allah's Messenger (ﷺ) said,
It is absolutely improper to bum any living creature in fire. The Shari'ah of Prophet Muhammad (ﷺ) has prohibited it in clear terms. The Prophet (ﷺ) has mentioned the reason for that, "The punishment of the fire may be given only by Rabb of the fire." Maybe it was permitted to earlier people."خَمْسٌ مِنَ الدَّوَابِّ كُلُّهُنَّ فَاسِقٌ، يَقْتُلُهُنَّ فِي الْحَرَمِ الْغُرَابُ وَالْحِدَأَةُ وَالْعَقْرَبُ وَالْفَأْرَةُ وَالْكَلْبُ الْعَقُورُ"Five kinds of animals are harmful and could be killed in the Haram (Sanctuary). These are: the crow, the kite, the scorpion, the mouse and the rabid dog."
Then the ant said, "O my brothers and sisters, although, we, the ants are a tiny insects, yet, in fact, we are very intelligent and a creature that plans-a strategist. The ants are a community by itself. And not only we are but all animals, birds and insects-all living creatures of Allah-are individual communities. All creatures, therefore, are separate communities by themselves. Scholars gain more knowledge about the ants through research and investigation, the truth of the Qur'an dawns upon us very clearly. And Allah know best."
وَالَّذِينَ كَذَّبُوا بِآيَاتِنَا صُمٌّ وَبُكْمٌ فِي الظُّلُمَاتِ مَنْ يَشَأِ اللَّهُ يُضْلِلْهُ وَمَنْ يَشَأْ يَجْعَلْهُ عَلَى صِرَاطٍ مُسْتَقِيمٍ"But those who deny Our verses are deaf and dumb within darknesses. Whomever Allah wills - He leaves astray; and whomever He wills - He puts him on a straight path." - [QS.6:39]
- Maulana Muhammad Zakaria Iqbal, Stories from the Hadith, Darul Isha'at.