DES MOINES, Iowa (AP) — Iowa officials agreed Tuesday to pay a group of attorneys nearly $5 million in a case that showed staff wrongly kept boys at a state-run school in isolation chambers and restraints.

The Iowa Appeals Board approved the payment to attorneys for former students of the Iowa Boys State Training School in Eldora. The former students earlier won a lawsuit against the state over their mistreatment.

The board — comprised of the auditor, treasurer and director of the Department of Management — approved the payments after the state lost a court challenge. A federal judge ordered the payment be made and the 8th U.S. Circuit Court of appeals affirmed the order.

The former students and their families sued the state in 2017, claiming their constitutional rights had been violated. The federal judge found that the Iowa Department of Human Services violated the boys’ due process rights under the 14th Amendment by failing to provide them with adequate mental health care and by improperly putting them in solitary confinement and mechanical restraints.

The school houses boys who have committed crimes. During the trial in 2020, witnesses testified that students — some as young as 14 — were often kept in isolation for weeks or endured a restraint device called “the wrap” that left them immobilized for up to five hours.

The lawsuit sought to force the state to change how the school was run. The state put new people in charge, and officials say the school made changes the judge ordered, including adopting a remedial plan and appointing a monitor.

Iowa Auditor Rob Sand questioned why the state allowed the case to go on for so long, which allowed legal fees to climb to $5 million even though lawyers sought changes at the school, but not damages. He acknowledged, however, that the fees were court-ordered and that the state had to pay them.

Children’s Rights Inc., of New York, will get $2.4 million; Ropes and Gray, of Chicago, will get $1.9 million; and Disability Rights Iowa, of Des Moines, will get $572,297.