SALT LAKE CITY — A federal judge accepted a settlement Tuesday that resolves a lawsuit against Utah's Department of Human Services and requires a reduction of treatment wait times for mentally ill individuals who are charged with crimes.

With the agreement finalized in court, the department can move toward implementing changes expected to drastically cut down the time it takes for those who are mentally ill and facing criminal charges to get into the Utah State Hospital for treatment so that their cases can advance.

The settlement between the department and the Disability Law Center, a nonprofit advocacy group, was announced last month but still needed a review and signature from U.S. District Judge Robert Shelby.

Under the now finalized agreement, the state must reduce the monthslong wait times for forensic treatment — treatment for those found incompetent to face the legal system — down to just 60 days. The state must reduce those wait times within six months once the changes are implemented.

The six-month timeline begins Sept. 30, said Dallas Earnshaw, Utah State Hospital superintendent, when the Department of Human Services will open its 22-bed forensic unit at the Salt Lake County Jail. The department received $3 million from the Utah Legislature this year, which will serve male inmates at the jail who are identified as candidates for treatment without being transported to the hospital.

After six months are up, the wait time will need to come down to 30 days by the year mark before hitting the goal wait time of just 14 days within 18 months.

"We're very pleased with the settlement agreement, we feel it's very fair and reasonable," Earnshaw said. "We feel it addresses the civil rights and the needs of those who are referred to us appropriately, and we really do want to be able to reach out and get these folks into programming as quickly as possible."

The Disability Law Center filed the lawsuit in September 2015 alleging that in light of extended wait times, individuals needing treatment preparing them to face the charges against them in court were being held for unconstitutional lengths of time — longer than the possible time they could be sentenced to if convicted.

Wait times for those who have been charged with crimes but are found incompetent to face them in court have stretched to six months, leaving mentally ill men and women warehoused in jails in the interim, according to an investigation by the Deseret News. The waits were considerably longer than those in other Western states.

Prolonged incarceration, typically in isolated or high-security confinement, has led to continued mental and physical decline for inmates while their families grapple with uncertainty and worry, according to the investigation.

Aaron Kinikini, legal director of the Disability Law Center, said he expects the need for competency restoration treatment in Utah will continue to grow in coming years.

"I think everyone, and especially us on the plaintiff side, anticipate this demand for forensic treatment is only going to increase with Utah population and, again, the ever-present lack of mental health treatment in the community," Kinikini said. "It's a great first step and at least the framework will be in place. … The state is going to have to think creatively as demand increases."

Under the agreement, a court monitor will closely follow the Department of Human Services' progress for the next five years, including collecting data that Earnshaw said will be essential to identify where the state needs to add service: beds at the Utah State Hospital, jail-based programs like the upcoming Salt Lake County unit, or additional outreach workers who make regular visits to patients while they remain in jail.

Because caring for mentally ill defendants is a nationwide problem, Kinikini anticipates the data collected will also be of interest to other states that are searching for solutions.

Kinikini noted that, because the Salt Lake County Jail's upcoming forensic unit will only be able to take male patients, the state will need to seek other options to care for mentally ill women in need of treatment. He also shared his concern that while the jail-based program does provide care, patients are still incarcerated rather than in a medical facility.

Other critical features of the settlement include a mandated 72-hour window for someone to be screened once a competency question arises and a review in one year of the state's outreach treatment program, Kinikini said.

While the state potentially could have cleared up the state hospital's waitlist sooner by reassigning some of the 152 beds reserved for mentally ill Utahns not charged with crimes, Earnshaw emphasized that the state rejected the idea so that no resources were taken away from county-level mental health services.

"It would really be devastating to our system," Earnshaw said. "In Utah we opted to protect those civil resources and to build a forensic system that was more effective and had a stronger long-term sustainability to it."