عن ابن مسعود رضي الله عنه قال: كنا مع رسول الله صلى الله عليه وسلم في سفر، فانطلق لحاجته، فرأينا حُمَّرَةً معها فرخان، فأخذنا فرخيها، فجاءت الحُمَّرَةُ فجعلت تَعْرِشُ فجاء النبي صلى الله عليه وسلم فقال: «من فجع هذه بولدها؟ ردوا ولدها إليها» ورأى قرية نمل قد حرقناها، فقال: «من حَرَّقَ هذه؟» قلنا: نحن قال: «إنه لا ينبغي أن يعذِّب بالنار إلا رب النار».
[صحيح] - [رواه أبو داود]
المزيــد ...
Ibn Mas‘ūd (may Allah be pleased with him) reported that we were on a journey with the Messenger of Allah (may Allah’s peace and blessings be upon him) when he went to relieve himself. We then saw a Hummarah (type of bird) with its two chicks. We took its chicks, and the bird came back and began to flap its wings. Upon seeing it, the Prophet (may Allah's peace and blessings be upon him) came and said: "Who has distressed it by taking its baby? Return its baby." He then saw an ant colony that we had burned and he said: "Who burned this?" We said: "We did." He said: "No one should punish with fire except the Lord of fire.”
[Authentic hadith] - [Narrated by Abu Daoud]
Ibn Mas’ūd (may Allah be pleased with him) reports that they were traveling with the Prophet (may Allah's peace and blessings be upon him) and that he went to relieve himself. The Companions then found a Hummarah – a type of bird – with its two chicks that they took away from the mother. So, it began flapping its wings and hovering above them as birds usually do when their chicks are taken from them. They flap their wings, hover, and screech at the loss of their babies. So, the Prophet (may Allah's peace and blessings be upon him) ordered that its babies should be released, so they released them. Then, he passed by an ant colony that had been burned, and when he asked who burned it, they said: "We did, O Messenger of Allah.” The Prophet (may Allah's peace and blessings be upon him) said: "No one should punish with fire except the Lord of fire," prohibiting such an act. Based on this, if you have ants in your home, you should not burn them with fire; rather, simply place something that will repel them like gasoline as it is well-known that if you sprinkle it on the ground, the ants will flee and will not return by the permission of Allah. If it is not possible to repel their harm except by their total extermination (the ants) using pesticides, then there will be nothing wrong with that, because in this case one is repelling their harm. Otherwise, ants are one of the things the Prophet (may Allah's peace and blessings be upon him) prohibited its killing. However, if they harm you and there is no other way to repel them except by killing them, then there will be no objection to killing them.