First of all, it is to be noted that Islam prohibits torturing living people and mutilating the dead, even if they are non-Muslims.
ٍOn this, Sheikh Faysal Mawlawi states the following:
First, it is not allowed to torture the living or mutilate the dead, even if they are non-Muslims. In the hadith of the Prophet (peace and blessings be upon him), when he was sending Hamzah Al-Aslami on an expedition, he instructed him saying: “If you find so-and-so, kill him. But never kill him by burning, for none uses fire in torturing except the One Who created it (i.e., Allah).” (Reported by Abu Dawud)
In another hadith, Safwan ibn `Assal said: The Prophet (peace and blessings be upon him) sent us on an expedition and said: “Move under the protection of Allah and for the sake of Allah. Fight those who disbelieve in Allah but never mutilate (the dead).” (Reported by Ibn Majah)
Second, it is permissible to mutilate the dead only in case of retaliation. If anyone cuts the ear of another, his ear is to be cut in return. If he inflicts any physical damage on anyone, he should be retaliated against in the same manner. In case of war, Muslim are allowed to take vengeance for their mutilated dead mujahids (fighters) in the same way it was done to them. Almighty Allah says: (If you punish, then punish with the like of that wherewith you were afflicted. But if you endure patiently, verily it is better for the patient.) (An-Nahl 16: 126)
This verse was revealed when the polytheists mutilated the corpse of Hamzah ibn `Abd Al-Muttalib (may Allah be pleased with him). The Prophet (peace and blessings be upon him) swore to mutilate seventy corpses of the polytheists in retaliation for what they had done with Hamzah’s body. Hence, this verse was revealed to indicate that punishment should be done in the same manner without any sort of transgression, so that the Prophet (peace and blessings be upon him) was permitted to mutilate only one corpse of the polytheists. However, the verse also shows that patience and refraining from retaliation are better in Allah’s Sight. Thereupon, the Prophet (peace and blessings be upon him) refrained from it and did not mutilate anybody.
Moreover, Dr. Ahmad Abu-Al-Wafa adds:
Mutilating the corpses of the dead is prohibited in man-made international law. It considers it a war crime for which severe penalty is due.
As far as Islamic shariah is concerned, two main points should be stressed:
1. 2. It is better not to reply to the evil acts of the enemy in the same manner, except if responding in the same way will deter the enemy from exceeding their limits by mutilating corpses. Almighty Allah says: (If you punish, then punish with the like of that wherewith you were afflicted. But if you endure patiently, verily it is better for the patient) (An-Nahl 16: 126) and (The guerdon of an ill-deed is an ill the like thereof. But whosoever pardons and amends, his wage is the affair of Allah. Lo! He loves not wrong-doers.) (Ash-Shura 42: 40)
Finally, Sheikh `Ikrimah Sabri, the former Mufti of Al-Quds (Jerusalem) and Khateeb of Al-Aqsa Mosque, concludes:
In fact, the principle of reciprocity has well-established rules in sharia, whereby Muslims are warned against embarking on such inhumane attitudes. For instance, if the enemy mutilates the dead bodies of Muslims, the Muslim army is not permitted to act in the same manner.
In all cases, Muslims should not initiate the aggression, for Islam is the religion of mercy. War is not the first option in the life of Muslims; rather, it comes after da`wah (call to Islam) and kind advice.