After 14 years on the bench, a circuit judge will have seen his share of cruelty and pain.

But Judge Michael Baxley wrote in a scathing 45-page ruling last week that South Carolina's mistreatment of prisoners with serious mental illness is the most troubling case he has ever encountered.

Even the most hard-nosed lock-'em-up-and-throw-away-the-key advocates should be shocked by the cases Judge Baxley cited: Vulnerable prisoners were in solitary confinement for years, in restraining chairs while naked and in painful positions, and naked in filthy, cold cells.

The ruling cited one incident in which a schizophrenic prisoner, who had been stripped and put in solitary confinement, later died in the hospital after being found on his cell floor in feces and vomit with 15 to 20 trays of "rotting, molding food."

The Department of Corrections said it will appeal the ruling. But the findings can't be ignored while the case proceeds through the courts. The rights and humane treatment of mentally ill inmates need to be addressed swiftly.

A number of other internal and external reports have described similar shortcomings, but the financially strapped Department of Corrections has not addressed the problems adequately, Judge Baxley concluded.

The Legislature should make it a top priority for the coming session to evaluate the circumstances and budget enough money for adequate staffing, medical care, medications and training.

The prisons have been a convenient place for tough-on-crime legislators to skimp when considering the budget. It's an easy sell on the way to the polls, and prisoners don't vote.

Judge Baxley's ruling should be a shocking reminder of the important role prisons play in the safety of citizens and the imperative to operate them humanely and efficiently. Prisoners who fail to get treatment for mental illness may re-enter society in worse shape than before incarceration.

No wonder. The judge cited the incidence of severely mentally ill prisoners who have been segregated for long periods of time - even years and years. Solitary confinement increases the risk for suicide and psychosis.

Inmates also have been treated with force - restrained in chairs, and left for hours, even as they bleed from self-inflicted wounds, the judge wrote. They have been sprayed with a chemical that causes eyes to burn.

He ordered the agency to develop a turnaround plan within six months to include screening and mental health treatment programs; a plan to employ sufficient mental health professionals; a plan to maintain treatment records and administer psychotropic medication with appropriate supervision and periodic evaluation; and a program to identify, treat and supervise inmates at risk for suicide.

It's a tall order. The incidence of serious mental illness within the general population is less than 4 percent. But Judge Baxley said the incidence in South Carolina's prisons is about 17 percent, or 3,500 inmates.

The ruling stems from a 2005 class-action lawsuit filed against the agency by the nonprofit group, Protection and Advocacy for People with Disabilities Inc., on behalf of inmates who are seriously mentally ill.

Corrections struggles under the difficulty of being perennially under-funded. Too few employees are expected to do an extremely difficult job for inadequate pay.

Nevertheless Judge Baxley is correct when he says treatment of prisoners with serious mental illnesses has to improve, despite the department's budgetary woes. And Corrections has to begin the reform process now.