BATON ROUGE, La. — A federal appeals court has overturned an order requiring Louisiana prison officials to keep the heat index on death row below 88 degrees for three ailing condemned killers.

Wednesday’s ruling by a three-judge panel of the 5th U.S. Circuit Court of Appeals is the latest twist in a 2013 civil rights lawsuit that has cost taxpayers more than $1 million.

U.S. District Judge Brian Jackson ruled Louisiana imposes unconstitutionally cruel and unusual punishment on the three death-row inmates once the heat index in their cells exceeds 88 degrees. His December 2016 order required officials at Louisiana State Penitentiary at Angola to continue using new measures, including modified ice chests, to protect the inmates from extreme heat.

But the 5th Circuit panel concluded Jackson’s ruling violated a previous order by the appeals court by incorporating a maximum heat index in his ruling. Heat index is a measure of temperature and humidity, and the indices on death row have routinely soared above 100 as temperatures and humidity levels rise during the summer.

In the panel’s majority opinion, Judge Jerry Smith said a “temperature trigger” can be used for deciding when to implement heat-control measures. But the courts can’t require the prison to maintain a “temperature ceiling” on death row, Smith wrote.

Lawyers for the three inmates urged Jackson to order the prison to install air conditioning throughout the death-row facility. But the judge said other heat remediation measures, costing less than $2,000 to implement, would adequately reduce health risks for the inmates and were the “least intrusive means” of protecting their rights.

For instance, Jackson required the prison to install a vent in a security door to divert cool, conditioned air from a guards’ pod to the inmates’ tier. He also ordered each inmate to be provided with an “IcyBreeze” unit, an ice chest that blows cold air.

But the state’s lawyers argued that Jackson “effectively” ordered the prison to install air conditioning by mandating a maximum heat index of 88 degrees.

“The sole purpose of these remedial measures is to ensure that the Plaintiffs are housed in air-conditioned cells where the heat index does not exceed 88 degrees,” wrote attorneys representing Attorney General Jeff Landry’s office.

Judge Smith said some of the new remediation measures may still be necessary “to redress the constitutional violation.”

“But the court cannot decree whether any given plan is necessary to lower the heat index to below a maximum, nor can it require the state to provide an undetermined number of IcyBreeze units or other measures to keep the heat index below a certain point,” he wrote.

The 5th Circuit sent the case back to Jackson, prolonging costly litigation that has lasted nearly five years.

Records obtained by The Associated Press in 2016 showed the case already had cost the state more than $1 million in legal bills. A plaintiffs’ expert has estimated it would cost about $225,000 — not including engineering fees or operating costs — to install air conditioning on death row’s six tiers.

During an interview in 2016, state Department of Corrections Secretary Jimmy LeBlanc said installing air conditioning on death row could open a “Pandora’s box” and possibly force his department to make the same accommodation for many other prisoners.

Landry praised the 5th Circuit’s ruling in a statement Wednesday.

“The Constitution does not require prisons to be comfortable; it requires them to be humane,” he said.

Mercedes Montagnes, a lawyer for the inmates, said plaintiffs’ attorneys were reviewing the decision.