Ruling on pests that get into food
Question

Some ants get into my powder juice and i dont know to how much extent they are spread. I think they are dead. I want know that if insects like ants, housefly, mosquitoes, etc falls or get into foods or drink dead or alive, can we eat or drink that food or do i need to separate them from food before eating or drinking?
Praise be to Allah.Firstly:
Islam forbids bad things (khabaa’ith).
Allah, may He be exalted, says (interpretation of the meaning):
“Those who follow the Messenger, the unlettered prophet, whom they find written in what they have of the Torah and the Gospel, who enjoins upon them what is right and forbids them what is wrong and makes lawful for them the good things and prohibits for them the bad things [khabaa’ith]”
[al-A‘raaf 7:157].
Pests are among the foods that the Arabs regarded as bad to eat (khabeeth) at the time the revelation was sent down, and they were the people to whom the Qur’an was first addressed.
Ibn Qudaamah (may Allah have mercy on him) said:
Allah, may He be glorified, says (interpretation of the meaning): “Prohibited to you are dead animals, blood, the flesh of swine, and that which has been dedicated to other than Allah” [al-Maa’idah 5:3]. With regard to everything else, whatever the Arabs regarded as good to eat is halaal, because Allah, may He be exalted, says (interpretation of the meaning): “and makes lawful for them the good things” [al-A ‘raaf 7:157], which refers to what they regarded as good to eat other than what is stated to be halaal according to Islamic teachings. This is supported by what He says in another verse (interpretation of the meaning): “They ask you, [O Muhammad], what has been made lawful for them. Say, ‘Lawful for you are [all] good foods…” [al-Maa’idah 5:4].
And what the Arabs regarded as bad to eat is haraam, because Allah, may He be exalted, says (interpretation of the meaning): “and prohibits for them the bad things [khabaa’ith]” [al-A‘raaf 7:157].
Those whose views as to what is good and what is bad (in terms of food) are regarded as carrying weight are the people of the Hijaz, specifically the people of the cities, because they are the ones to whom the Qur’an was revealed and addressed, and the Sunnah was addressed to them. So with regard to words (good and bad) that are used without qualification, reference is to be made to their customs, and not those of anyone else. The customs of the desert dwellers are not to be taken into consideration, because due to necessity and hunger they would eat whatever they could find.
Once this is established, the things that are regarded as bad to eat (khabeeth) are pests, such as: worms, black beetles, wood lice, dung beetles, mice, geckos, chameleons, burrowing lizards, rats, scorpions and snakes.
This is the view of Abu Haneefah and ash-Shaafa‘i…
End quote from al-Mughni (13/316-317).
This is the view of the majority of scholars.
Ibn Hubayrah (may Allah be pleased with him) said:
[The scholars] are agreed that the vermin of the earth are haraam (to eat).
Except Maalik; he regarded this as makrooh but not haraam, according to one of the two reports narrated from him. According to the other report, he said that it is haraam.
End quote from Ikhtilaaf al-A’immah al-Ulama’ (2/335).
For more information, please see the answer to question no. 21901.
Secondly:
Based on the above, you should remove these pests from the food, because they are bad to eat.
This applies if it is possible to remove them, and is not too difficult, in the case when these pests are visible and can be distinguished from the food.
It was narrated that Abu Hurayrah (may Allah be pleased with him) said: The Prophet (blessings and peace of Allah be upon him) said: “If a fly falls into the drink of one of you, let him submerge it then take it out, because on one of its wings there is a disease and on the other there is a remedy.” Narrated by al-Bukhaari (3320). But if these pests are few, small and difficult to find, they may be overlooked, because Islamic teachings aim to relieve people of hardship and that which is difficult for them.
Allah, may He be exalted, says (interpretation of the meaning):
“Allah intends for you ease and does not intend for you hardship”
[al-Baqarah 2:185]
“Allah does not intend to make difficulty for you”
[al-Maa’idah 5:6].
Al-Mirdaawi (may Allah have mercy on him) said:
Shaykh Taqiy ad-Deen favoured the view that a small amount of any impurity may be overlooked, in food or otherwise, even mouse droppings. He said in al-Furoo‘: What this means is that this is the view favoured by the author of an-Nazm. I say: It says in Majma‘ al-Bahrayn: I say: It is more appropriate to overlook a tiny amount of impurity on clothing or in food, because it is too difficult to avoid it, and undoubtedly any man of reason will realize that this problem is widespread, especially in mills, sugar presses and olive presses, and it is more difficult to guard against than food from which a mouse has eaten, or the blood and vomit of flies. Many of our companions favoured the view that things contaminated with these things are to be regarded as pure (taahir).
End quote from al-Insaaf (2/334-335).
And Allah knows best.