In the name of Allah, the Beneficent, the Merciful
It is not lawful for Muslims to torture people or inflict any pain upon criminals beyond the limits prescribed by Allah.
Hisham ibn Hakim passed by some people in Syria who had been made to stand in the sun and had oil poured over their heads. He asked, “What is this?” It was said, “They are being punished for not paying taxes.” Hisham said: I heard the Messenger of Allah, peace and blessings be upon him, say:
إِنَّ اللَّهَ يُعَذِّبُ الَّذِينَ يُعَذِّبُونَ فِي الدُّنْيَا
Verily, Allah will torture those who torture people in this world.
Source: Sahih Muslim 2613, Grade: Sahih
Jabir ibn Abdullah reported: The Messenger of Allah, peace and blessings be upon him, said:
وَلاَ تُعَذِّبُوا خَلْقَ اللهِ عَزَّ وَجَلَّ
Do not torture the creation of Allah the Exalted.
Source: Al-Adab Al-Mufrad 188, Grade: Sahih
It is a major sin leading to Hellfire for someone to torture an animal, let alone another person.
Ibn Umar reported: The Messenger of Allah, peace and blessings be upon him, said:
عُذِّبَتْ امْرَأَةٌ فِي هِرَّةٍ أَوْثَقَتْهَا فَلَمْ تُطْعِمْهَا وَلَمْ تَسْقِهَا وَلَمْ تَدَعْهَا تَأْكُلُ مِنْ خَشَاشِ الْأَرْضِ
A woman was punished because of a cat she had imprisoned until it died; thus, she entered Hellfire because of it. She did not give it food or water while it was imprisoned, neither did she set it free to eat from the vermin of the earth.
Source: Sahih Bukhari 3295, Grade: Muttafaqun alayhi
The vast majority of Muslim countries have signed the United Nations Convention Against Torture which states:
Each State Party shall take effective legislative, administrative, judicial or other measures to prevent acts of torture in any territory under its jurisdiction. No exceptional circumstances whatsoever, whether a state of war or a threat of war, internal political instability or any other public emergency, may be invoked as a justification of torture.
Source: Convention against Torture and Other Cruel, Inhuman or Degrading Treatment or Punishment
In conclusion, the Prophet has forbidden Muslims from torturing people and in practice Muslim countries have taken legal and administrative action to prevent torture.
Success comes from Allah, and Allah knows best.