The life of Muhammad teaches that torture is sanctioned in cases of interrogation. The prophet of Islam did not stop his people from beating and abusing individuals in his presence when information was needed, whether it concerned a matter of sexual impropriety or the location of wealth that could be looted. In at least one case of the latter, he is noted to have directly ordered the torture.
Torture is also allowed when putting people to death. Rather than prescribing quick execution of captives, there were times in which Muhammad ordered his men to make a victim's death as slow and agonizing as possible. In one case, Muhammad's men literally pulled apart the body of an elderly woman named Umm Qirfa by tying her limbs to camels then sent in opposite directions
One of the most influential Shi'a religious leaders in Iran recently extended the validity of torture to the practice of rape of prisoners, as long as it is in defense of Islam. Mesbah-Yazdi said that it was advisable for the rapist to "perform a ritual washing first and say prayers while raping the prisoner."
Mesbah-Yazdi went on to add that "If the judgment for the [female] prisoner is execution, then rape before execution brings the interrogator a spiritual reward equivalent to making the mandated Haj pilgrimage [to Mecca], but if there is no execution decreed, then the reward would be equivalent to making a pilgrimage to [the Shi'ite holy city of] Karbala."
According to the cleric, "If the prisoner is female, it is permissible to rape through the vagina or anus." When asked if the rape of men and young boy was considered sodomy, he said, "No, because it is not consensual."