BOISE, Idaho — A federal judge has ruled that Idaho prison officials failed to enact court-mandated prison health care improvements for two years from 2014 to 2016 and that some of the officials did not read the court order outlining what was supposed to be done.

U.S. District Judge David Carter said in the ruling issued last month that the Idaho Department of Corrections eventually worked to correct the problems and that he will not issue contempt of court fines for now.

The judge also said he doesn’t currently plan on extending the amount of time that health care at the Idaho State Correctional Institution must remain under federal court oversight.

That means a 36-year-old lawsuit filed on behalf of inmates — and subsequent court oversight — could come to an end within the next several months.

That would be welcome relief for state lawmakers and prison leaders charged with running the 1,446-bed prison south of Boise that typically houses Idaho’s sickest inmates.

But the ruling also means the stakes are high for inmates at the prison, because once this lawsuit ends they’ll have to file a completely new legal action if medical delivery problems resume.

The case started in 1981 when inmates from the Idaho State Correctional Institution began filing so many lawsuits against prison officials that they threatened to clog Idaho’s federal court. A judge noted similarities between the cases and combined them into one class-action lawsuit.

The claims ranged from overcrowding and excessive violence to limited access to medical care. Some have been settled, but the medical care complaints continued.

In 2012, an expert hired by the court to examine the medical care at the prison found major problems, including some that he said led to prisoners being gravely injured or dying. The expert said the poor medical care amounted to cruel and unusual punishment, a characterization that the state strongly protested.

After the expert released his findings, the inmates had a choice — they could go to trial, potentially waiting up to 18 months before a ruling would be issued, or go into mediation in hopes of a quicker solution.

“The inmates opted for mediation because they desperately needed something they could enforce and thought a quicker substantive resolution would result from mediation,” Carter wrote in his ruling.

The lawsuit seemed close to a conclusion a couple of years ago when all sides agreed to a deal in which the state would make several improvements to medical care, and the court would oversee the changes for two years to ensure Idaho officials followed through.

The deal revolved around a compliance plan to ensure inmates received adequate medical and mental health care and that prison officials monitored the medical care system to make sure it operated properly.

State corrections officials were supposed to train prison medical care workers on the new rules and make sure the state’s prison medical care contractor, Corizon, complied with the plan.

The judge formally approved the plan in 2014, but Carter wrote in his ruling that the state correction department’s health services administrator, Corizon officials and the medical workers never read the court-ordered new plan.

The state didn’t even notice the problem until the summer of 2015, when newly promoted Deputy Chief of Prisons Ashley Dowell realized the error.

The judge noted Dowell and other prison officials began working immediately to correct the problem, but said it still took another year for the state to become compliant with the court order. Carter found the state to be in contempt of court for those two years.

The state still has a ways to go before the lawsuit is closed. A new audit of the prison’s medical and mental health care system is expected to be released later this year. If the results are positive, the state could ask to bring the lawsuit and court oversight to an end.