KADUNA , Nigeria — The Nigerian police have rescued more than 300 men and boys who were chained and starving in a building believed to be an Islamic school in the northern city of Kaduna, in what a police official on Friday described as a case involving human slavery.

Many of the captives were children who had metal chains around their ankles, a police spokesman, Yakubu Sabo, told Reuters. He said that at least seven teachers from the school had been arrested.

The police chief of Kaduna State, Ali Janga, told the BBC that the building had been raided on Thursday after a tip on what he called a “house of torture.”

The detainees were not all Nigerian, Mr. Janga said, and they had been tortured, sexually abused, starved and prevented from leaving, in some cases for years.