Who decided torture was immoral? And what does it matter if someone's morals are consistent? Morals are completely made up construct. They vary depending on the culture and depending on the era. They are made up by the alfa dogs of the world and primarily only serve the society that made them up and the particular factions of its ruling classes.
Torture absolutely works. But you have to know the person is guilty and have a general idea what info your looking for which they have. If you simply torture detainees fishing for random information like our modern idiotic government has likely been doing, it wont work. Example, you capture someone you already know has connections to a drug boss, you want to get the boss's name & location. Example of it not working, you capture an Arab you suspect of being a terist, you tell a low level soldier to torture him to find out if he's a terist and whatever random info they might have.