A fatwa about the mutilation of corpses at Islam Online (thanks to LGF) opines that such mutilation is not permissible in Islam “” except in cases of retaliation. It is likely that at least some people in Fallujah were thinking that that was a sufficiently large loophole to justify what they were doing.
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 ye punish, then punish with the like of that wherewith ye were afflicted. But if ye endure patiently, verily it is better for the patient” (An-Nahl: 126).
This verse was revealed when the polytheists mutilated the corpse of Hamzah ibn `Abdul-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.”
The Qur’an verse cited, 16:126, says that patience is better, but does not forbid retaliation.