Answered by Shaykh Faraz Rabbani
Question: Is it permissible to kill insects and harmful animals through means of traps?
Answer: In the Name of Allah, Most Gracious, Most Merciful
To kill animals and insects which are harmful to one’s self or belongings (such as pests) is permissible. At the same time, maximum effort should be made to minimize suffering and pain. In the famous Hanafi Fiqh reference Fatawa al-Hindiyya, there is a whole chapter regarding the killing of animals and what may and may not be done.
Therefore, to keep traps which kill the animals is permissible, though ones that cause slow or unnecessarily painful death are not permitted to use. Similarly, burning animals is also impermissible.
Abu Hurayra narrated that, “The Messenger of Allah (blessings and peace be upon him) forbade making animals suffer.” [Bukhari]
The Prophet (Allah bless him & give him peace) also said, ” Do not harm the creation of Allah.” [Abu Dawud, from al-Ma`rur ibn Suwayd. Imam Jamal al-Din al-Zayla`i declared it to be a rigorously authenticated (sahih) hadith in Nasb al-Raya.]
This is why Ibn Hajar al-Haytami (Allah have mercy on him) mentions in his work on the major sins, al-Zawajir, that the scholars have explicitly stated that causing animals undue harm, such as hitting them painfully, without a sound reason is a major sin (kabira). [Ibn Hajar al-Haytami, al-Zawajir `an Iqtiraf al-Kaba’ir, 2.140]
And only Allah knows best.