Prison is supposed to be a bad place, right? Inmates shouldn’t have comfortable living conditions, right? Especially not air-conditioning, right? Wrong.

If rehabilitation is the goal of incarceration — and it should be — then prisoners shouldn’t be treated like caged animals. Unless, of course, you want prisoners to act like animals when they get out; and most prisoners will eventually get out.

So why is it so hard for Texas politicians to get it through their heads that improving prison conditions, including installing air-conditioning in cell blocks to combat triple-digit summer heat, isn’t just good for the inmates, it’s good for public safety?

EDITORIAL: Treating state convicts humanely means adding air conditioning to Texas prisons

RELATED: 2 Texas prison guards, 2 inmates treated for heat-related illnesses

Prisons and jails shouldn’t promote criminality, but too often they do. Inadequate security leads to predation, exploitation and abuse. Intolerable living conditions fuel anger, resentment, recidivism and sometimes death.

Twenty-two people have died as a result of oppressive conditions at 15 state prisons since 1998, according to the Texas Department of Criminal Justice. The dead include Larry Gene McCollum, a 58-year-old inmate at the Dallas-area Hutchins Unit, who died of heat stroke in July 2011. McCollum had a body temperature of 109 degrees when guards found him. A federal judge last year blamed the state for McCollum’s death.

In another case, U.S. District Judge Keith Ellison ruled earlier this year that conditions were so bad for the 1,400 geriatric inmates at the Wallace Pack Unit in Navasota that the state had violated their Eighth Amendment protection against “cruel and unusual punishment.”

A settlement of that lawsuit, originally filed in 2014, brought some air-conditioning to the Pack Unit, but only 29 of the 104 state-run jails and prisons in Texas have air-conditioning in their cells or inmate dormitories. How many more lawsuits have to be filed before state politicians get the message? Are they waiting for more inmates to die?

A Texas Department of Criminal Justice spokesman suggested the state is doing the best it can by providing air-conditioned respite areas, cold showers, ice water, electrolyte drinks and cooler meals. That’s not enough to avoid another preventable death in state custody.

Nor does it address the fact that guards and other prison staff at times must endure the same conditions as inmates. In fact, two prison guards and two inmates at Texas prisons had to be treated for heat-related illnesses this week.

Jennifer Erschabek, executive director of the Texas Inmate Families Association, says it’s unbearable for inmates, even in prison units with air-conditioning, because the AC units typically don’t work properly. “Something has got to be done to where we’re not fighting this environmental issue that these buildings aren’t built to handle,” she said.

State Sen. John Whitmire, D-Houston, chairman of that chamber’s corrections committee, believes lawmakers are getting the message “because they don’t want to be back in court.” State Rep. James White, R-Hillister, who chairs the House corrections committee, says there may not be “a Carrier air-conditioner in every cell block,” but “we’re going to find a way” to improve prison conditions.

That’s good to hear. Elected officials may not want to spend political capital trying to convince voters they’re not coddling inmates, but it’s time that they made the issue a priority. And Gov. Greg Abbott needs to lend his strong voice to the effort.

Across America in recent years it has been easier to push for larger prison budgets when it means building more warehouses for inmates. But investing in improved prison conditions will take a bigger bite out of crime in the long run by reducing recidivism.

Combine that with other rehabilitation measures — including drug counseling, anger management, GED instruction, and job training — and Texas would see fewer of its 165,000 inmates return to prison again and again. Then, it could divert some of the $3.3 billion it annually spends to house the nation’s largest prison population to other needs, including quality public education.

That makes more sense than caging prisoners in cell blocks that can get as hot as an oven.