SPRINGFIELD, Ill. — Part of a mental health center in suburban Chicago is being repurposed to provide treatment to Illinois inmates who have serious mental illnesses, Gov. Bruce Rauner’s administration announced Friday.

The move is part of a settlement from a 2007 lawsuit against Illinois that resulted in the state being ordered to provide better care for its mentally ill inmates.

An agreement between the Illinois Departments of Corrections and Human Services will change two sections of the Elgin Mental Health Center to accommodate 44 beds for inmates who require inpatient care. The transition will happen over the next four months, according to a copy of the agreement.

Rauner’s administration hailed the plan as a positive step to improve how mentally ill inmates are treated. But the state’s largest employee union, which represents the workers at Elgin, says the change comes at the cost of beds that provide services to the public.

“Prisons were not designed to be mental health facilities but we must adjust to this reality,” said John Baldwin, director of the Illinois Department of Corrections. “This new inpatient treatment program will allow us to provide focused care for seriously mentally ill offenders and help them deal with daily stressors of a prison environment.”

Elgin currently has 344 beds for people who were deemed unfit for trial or were found not guilty by reason of insanity, and another 75 are “civil” beds, meaning they’re meant to provide mental health services to the public.

Rauner’s office says no service reductions to the public are expected, and that civil patients currently in Elgin will have been discharged by the time the transition is finalized or transferred to other facilities in the state.

But Anders Lindall, spokesman for the American Federation of State, County and Municipal Employees in Chicago, the union representing state workers, said the changes at Elgin will wipe out 50 beds that hundreds of people use every year.

Lindall said there’s already fewer places for people to go for mental health services in the Chicago area and the 14 counties the Elgin center serves. He agreed with the need to provide mental health services to inmates outside of prison, but added that “it has to come from expanding capacity.”

“The Rauner administration should not cannibalize what little capacity for mental health services still remains,” he said.