Media playback is unsupported on your device Media caption Footage of people chained inside the religious school

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.

An inquiry has already been ordered.

At least two people helping run the madrassa have been arrested, but the head escaped, police said.

The BBC Urdu Service's Hasan Kazmi saw the rescued people in a police station several hours after the raid. They were still in chains because police could not find the keys.

'Parents applied chains'

Students have described the brutal regime inside the seminary - some spoke to the media while still wearing their chains.

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.

Analysis The chaining of victims in private jails run by influential feudal lords is not unheard of in Pakistan, and there have also been examples of drug addicts being chained by some rehabilitation centres to prevent them from escaping. But the discovery of chained students of a religious seminary who claim they were being motivated to join the ranks of Taliban has come as a shock. These claims are still being verified as there seems to be no evidence of any weapons training being given there. Locally, the madrassa appears to have had a reputation of being a faith-based centre for rehabilitation of drug addicts and juvenile criminals, and it charged substantial fees. It was known in the area as the "Jail Madrassa" due to its harsh treatment methods, including chaining and corporal punishment.

One boy said Taliban members had visited the seminary and told them to "prepare for battle".

"Every possibility including its involvement in militancy will be investigated," Sharfuddin Memon, home affairs spokesman for Sindh province told AFP news agency.

A number of the students appear to have been involved in drugs or petty crime.

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.

'Torture and abuse'

The captives were found during a police raid on the seminary in the central Sohrab Goth district of Karachi late on Monday, police said.

One media report says the police received a tip-off that the head of the seminary kept students chained in the basement and subjected them to torture and abuse.

"Those recovered are aged between 12 and 50 and are mainly of Pashtun ethnicity," Gadap Town police superintendent Rao Anwar told Pakistan's Express Tribune newspaper.

At least 18 of those rescued were aged 20 or younger, another police official told AFP.

There are thousands of madrassas in Pakistan providing education for more than two million students, some estimates say.

But officials suspect that there are many unregistered and unregulated seminaries and in some areas these represent the only affordable educational option for children of poor families.

There have been a few instances where students have been mistreated in such seminaries, but an incident on this scale and in such a major city is rare, correspondents say.

Some Islamic schools in Pakistan are accused of being training camps for militants, but while police say they are investigating such links in the Karachi school, they suggest that the primary reason students were left there was for rehabilitation.