Cook County Chief Judge Timothy Evans has reached a deal with the county and Board President Toni Preckwinkle months after filing suit to avoid layoffs in his office.

The settlement will give Evans $8 million in new funding and credits to the Office of the Chief Judge for 2018 and another $2.5 million in capital improvement funding in 2019, according to a statement from Preckwinkle’s office.

Evans’ office had sued last year, and a judge had issued a temporary restraining order halting the layoffs.

That settlement is “for a dollar value much lower than what was initially demanded” and will “promote future savings” in Evans’ office, Preckwinkle said in a statement. “Our goal in engaging in good-faith negotiations was to achieve operational savings and efficiencies” in return providing more money to Evans’ office, the statement continued. “We believe we have done so.”

The Juvenile Temporary Detention Center will lose 22 positions under the settlement; roughly 180 positions were to be terminated under budget cuts proposed in November.

Behavioral health services for juveniles will be turned over to the Cook County Health and Hospitals System by Sept. 1; those services had been provided by an external vendor.

The settlement also includes closing branch courts at 51st and Wentworth and Belmont and Western, as well as closing one residential center at the juvenile detention center.

The Annie E. Casey Foundation will do an operational and staffing study at the detention center, and the National Center for State Courts will do a court utilization study for the office.

In November, lawyers representing Evans’ office argued for the county to provide the office with at least $290 million in the 2018 budget — $41 million more than he was set to receive.

In a statement Wednesday, a pleased Evans said the lawsuit made it clear that the county board has no authority to lay off court employees. It just sets funding levels, Evans said, and the court decides how the money is used.