A federal judge has ruled that New Hampshire has one year to stop the involuntary holding of psychiatric patients in hospital emergency rooms.

The same judge ruled in February that the Granite State’s practice is unconstitutional because it illegally commandeers hospital resources. She gave the state and hospitals a chance to develop new procedures together, but the two sides couldn’t come to an agreement.

According to the judge’s new injunction, the state can only hold people in emergency rooms for up to six hours before transferring them to a facility for treatment. State officials had asked for a 12-hour limit.