About 50 students have been freed from a religious school in the Pakistani port city of Karachi, where some were being kept in chains, officials say.
The male students, some as young as 12, were reportedly beaten, deprived of food and kept in what police say amounted to a torture chamber.
Some parents paid for their children to attend the school known as the “jail madrassa” because their sons were addicted to drugs or involved in crime.
One said he was beaten 200 times, while another said they were told they would be sent to join the jihad and if they tried to escape they would get 200 lashes.
"I was kept in the basement for the past month and was kept in chains. They also tortured me severely during this period. I was beaten with sticks," student Mohi-ud-Din told Reuters news agency.
Our correspondent met one teenager who said they were forced to study all hours. “We were not provided proper food or clothing,” he said.
One boy said Taliban members had visited the seminary and told them to “prepare for battle”.
Some parents paid substantial amounts to enrol their children at the seminary and correspondents say that in some cases parents actually applied the chains which imprisoned their children.
Many parents had left their children at the madrassa for treatment, believing that the harsh regime would aid rehabilitation - some of these parents told the BBC they were happy with the result. They say they were chained to prevent them for escaping.
"If a child has issues such as bad company, smoking and drugs then we have no choice but to get him admitted in such places," Mohammed Qasim, the father of one student, told the BBC.
Babar Khan, 16, spent nine months in the “jail school”.
Originally from Karachi, he was taken there by his parents because he would not go to school.
"We were not able to see the sun or the moon for several days at a stretch," he said.
"We were kept in an underground room while small kids were kept on the first storey with chains.
"The last time I had tea was several months back. They would serve us dinner after midnight. But that too would be in small portions.
"Mostly the food was lentils with lots of water and no salt or spices. The students used to fight over bread. This too when my parents were paying them 8,000 rupees [about $90; £58] a month in fees.
"I was beaten up the first day after my parents left me here.
"We were allowed to talk to our families once a month on the telephone or [have] one visit a month from family members.
"They told us not to talk about our status with them.
"Before any visit, they would let us have a bath and wear clean clothes.
"A school worker was made to sit with us to listen to our conversations.
"They warned us we could meet bitter treatment if we told our parents about it.