In the name of Allah, the Compassionate, the Merciful.
Abu Hurayra related that,
“The Messenger of Allah (blessings and peace be upon him) forbade making animals suffer.” [Bukhari]
To kill animals and insects which are harmful to one’s self or belongings (such as pests) is permissible.
However, maximum effort should be made to minimize the suffering and pain. One should not burn them nor use means that cause slow or unnecessarily painful death. There is a whole chapter in the famous Hanafi Fiqh reference Fatawa al-Hindiyya regarding the killing of animals and what may and may not be done.
Therefore, to keep traps which kill the animals is permissible, although traps which disable them or cause slow, painful death may not be kept as harming the animal and making it suffer is not permissible.
Abu Hurayra related that, “The Messenger of Allah (blessings and peace be upon him) forbade making animals suffer.” [Bukhari]
The Prophet (Allah bless him & give him peace) 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.
Answered By: Shaykh Mufti Muhammad ibn Adam al-Kawthari