Killing insects by means of electric shock
Question

What is the ruling on killing flies by means of electric shocks?.
Praise be to Allah.There is nothing wrong with using the machines that give electric shocks and are well known nowadays in order to kill insects and get rid of them. That is for a number of reasons: 
1.
What is forbidden is killing with fire, because of the hadeeth of Abu Hurayrah (may Allah be pleased with him), according to which the Prophet (blessings and peace of Allah be upon him) said: “No one should punish with fire except Allah.” Narrated by al-Bukhaari (3016). The Prophet (blessings and peace of Allah be upon him) saw an anthill that one of the Companions had burned with fire and he said: “No one should punish with fire except the Lord of fire.” Narrated by Abu Dawood (2675), classed as saheeh by al-Nawawi in Riyadh al-Saaliheen (519) and by al-Albani in al-Silsilah al-Saheehah (487). 
As for electric shocks, they are different from fire, because killing with electricity refers to using the electrical current in order to destroy cells and break the blood vessels in a rapid manner. If the current is increased to a higher level then heat is produced which appears on the victim as a change of colour and scorching, so it appears as if he has been burned with fire, but in fact it is electricity and not fire. 
2.
There is an obvious need for this beneficial method of killing nuisance insects. 
A fatwa has been issued by contemporary scholars stating that this method of killing insects is permissible: 
The scholars of the Standing Committee for Issuing Fatwas were asked: What is the ruling on killing insects with electric shocks, knowing that the Prophet (blessings and peace of Allah be upon him) enjoined killing properly and slaughtering properly? 
They replied: 
If these insects are indeed harmful and there is no way to put a stop to their harm except killing them by means of electric shocks and the like, then it is permissible to kill them in that way as an exception to the command to kill properly in cases of necessity, because of the general meaning of the words of the Prophet (blessings and peace of Allah be upon him): “There are five kinds of creatures, all of which are harmful and may be killed inside and outside the sanctuary: crows, kites, scorpions, rats and vicious dogs.” (al-Bukhaari and Muslim) 
And because the Prophet (blessings and peace of Allah be upon him) enjoined fully submerging flies that land in one’s drink, and that may mean killing them. End quote. 
Fatawa al-Lajnah al-Daa’imah, 26/192 
Shaykh Ibn ‘Uthaymeen said concerning this machine in Fatawa Noor ‘ala al-Darb (al-Haywaanaat/ p. 2): There is nothing wrong with it for a number of reasons: 
1.
The shock it gives does not cause burning, rather it is a shock that sucks out the life, based on the fact that if a piece of paper is placed on this machine it does not burn. 
2.
The one who sets up this machine is not intending to torment the mosquitoes and insects with fire, rather his aim is to ward off their harm. The hadeeth forbids tormenting with fire, and the one who uses this machine does not intend to cause pain to them, except for the purpose of warding off their harm. 
3.
In most cases it is not possible to kill these insects except by means of this machine or by means of chemicals which give off an unpleasant smell and which may cause harm to the body. The Prophet (blessings and peace of Allah be upon him) burned the date palms of Banu’l-Nadeer, and date palms usually are not free of birds or insects and so on. End quote. 
In Liqaa’aat al-Bab il-Maftooh (no. 59/ question no. 12) it says: 
We think that there is nothing wrong with it and that this does not come under the heading of tormenting with fire, because according to what we know about it, the insect dies as a result of the electric shock and what proves this is that if you were to bring a piece of paper and put it on this machine it would not burn, which shows that this does not come under the heading of burning but rather under the heading of electric shock, just as if the person were to touch an exposed electrical cable, he would die without being burnt. End quote. 
And Allah knows best.