For nearly a decade, South Carolina's dirty little secret remained all but hidden behind concrete walls and dense legal papers before a court ruling this year accused prison officials of running a virtual chamber of horrors for mentally ill inmates.

For an interactive map locating all of the state's prison facilities, click here.

For that entire time, the state was well aware of the failings in its prison mental health system, which one expert described as being in "profound crisis" as far back as 2000. But the Department of Corrections balked at making substantial changes, excusing its conduct as the result of insufficient money and security needs.

Now, after Circuit Judge Michael Baxley ordered the Corrections Department to quit equivocating and fix the problem, prison officials and lawmakers are casting about for solutions to overhaul a damaged system that bred abuse and neglect.

Last year, the Legislature coughed up an additional $1.2 million for the Corrections Department to hire more counselors and improve mental health care for inmates. But that amount is not nearly enough to cover the changes ordered by Baxley, experts said.

Former state prison chief Jon Ozmint has suggested that fix could cost $50 million or more - in the first year alone.

Neither Gov. Nikki Haley nor legislative leaders have signaled support for pouring that kind of money into the prisons. Instead, the state is now setting its sights on an appeal of Baxley's order, challenging what some see as a constitutionally questionable attempt to legislate from the bench.

Baxley's frustration with the pace of reform seethed through his January order, which gave the Corrections Department a deadline of 180 days from his final order to draft a plan for fixing the system. He remained visibly irritated when the prison system's attorneys asked him at a hearing this month to reconsider his ruling, suggesting he was micromanaging the department.

"Would you have the court walk away and leave it as it is?" the judge asked. "You have lost the vision of what is happening in the Department of Corrections with respect to people who are suffering and dying."

The new corrections director, Bryan Stirling, insists that's not the case, and that a lack of money won't stop him from looking for ways to improve mental health care for prisoners. To that end, he and his staff have been meeting with experts and the folks behind the lawsuit that led to Baxley's ruling.

Stirling said a plan for change could be ready for the governor's perusal as early as this summer. But that would come too late for any big-ticket initiatives to make their way into next year's budget.

That means Stirling likely will have to work within the margins for now, tinkering with changes in policy and procedure that don't require extra cash. He cautioned people to be patient as officials try to mend a system with long-standing issues.

"I don't want to just throw money at the problem," Stirling said. "This is not going to be fixed overnight."

Stirling met last week with a top official from Mississippi's prison system to learn more about how that state improved prison conditions for the mentally ill and reduced the number of inmates housed in solitary confinement, a tactic widely regarded as psychologically damaging. He also has reached out to the state Department of Mental Health for advice and is looking to expand training to better prepare officers for dealing with inmates in mental crisis.

Sen. Mike Fair, chairman of the Senate Corrections and Penology Committee, said another possibility is getting schools such as the Medical University of South Carolina to have psychiatrists in training perform their residencies in prisons to help boost inmates' access to care.

"We've got to get this done," the Greenville Republican said, "and I see them as part of the solution."

More with less

On a recent morning, more than a dozen men filed into Kirkland Correctional Institution in Columbia, the first stop in a new prisoner's tour. Here, they lined up and underwent searches for potential weapons or other prohibited goods before being evaluated for assignment in one of the state's 25 prisons.

An intake officer flagged down a co-worker and pointed to an inmate leaning against a glass wall. He wants to kill himself, the officer said.

"That's normal," the co-worker replied. "It doesn't really hit them that they're about to spend a long time in prison until they're going through that process."

Threats of self-harm will earn the inmate a session with a mental health counselor, who will make an evaluation on treatment. But given the staff on hand, it could be a month before he gets a sit-down with a prison psychiatrist to discuss his suicidal thoughts.

Beverly Wood, chief psychiatrist for the prison system, said she has the equivalent of five-and-a-half psychiatric staff members for the entire prison system but could use about twice as many. The prisons have an estimated 3,500 inmates with mental health problems. "You have every diagnosis you can imagine in here."

The Legislature didn't provide money to add more psychiatrists this year. That's partly because corrections officials did not ask for it.

South Carolina's prisons have been on a financial diet since at least the mid-1990s, when a no-nonsense Texan named Michael Moore was brought in to run the system with an eye toward austerity.

In the years since, South Carolina has consistently ranked at or near the bottom for prison spending nationally.

In 2005, the year the lawsuit was filed, South Carolina spent 42 percent less per day on its inmates than 16 states surveyed by the Southern Leadership Conference. That year, South Carolina spent less money per inmate than any state in the nation.

At the same time, South Carolina's prisons became virtual warehouses for the mentally ill due to cutbacks in mental health care. The state Department of Mental Health, for example, has seen its budget shrink 40 percent in the last decade, the largest drop of any state since 2002.

In South Carolina, at least five times more mentally ill people are housed in jails and prisons than in hospitals, a 2010 study by the nonprofit Advocacy Treatment Center and the National Sheriffs' Association found.

The state is not alone in this problem. In 2012, an estimated 356,268 inmates with severe mental illnesses filled the nation's jails and prisons, leading some experts to dub the facilities "America's new asylums." Other states also have struggled to hire and retain enough trained mental health staff, and other states have faced lawsuits and allegations of abuse as well. Just last week, North Carolina fired seven prison workers in connection with the death in March of a mentally ill prisoner held there in solitary confinement.

But Baxley and others have criticized South Carolina officials for what they perceive as a slothlike pace in taking action to remedy its problems.

Working to improve

Prison officials insist they have been doing the best they can in this environment.

During the 2012 trial that preceded Baxley's ruling, officials testified about a variety of efforts they have undertaken since 2005 to boost mental health staff and improve group therapy programs, housing for inmates and training for correctional officers and staff. Officials said these types of improvements are continuing.

"We are working very hard to improve," Kennard DuBose, director of clinical counseling for the prison system, said. "(The lawsuit) is absolutely not representative of who we are in 2014."

One example they point to are special dorms set aside for mentally ill prisoners at Lieber, Lee and Perry state prisons. The idea is to reduce problems and improve care by placing them in a more supportive, secure environment with greater privacy and regular access to therapy and counseling.

The unit at Lieber has 159 beds, and all but seven were filled last week.

Warden Joseph McFadden said he looks for a mix of compassion and patience in the officers assigned to work in the unit. He points to people like Lt. Deloris King, an 11-year corrections veteran who previously worked with mentally ill patients in a nursing home.

King said it helps to have empathy, a thick skin and the patience to know that an inmate, once calmed, may well regret the things he said during a frustrated outburst. "I've been called every name you can possibly think of," she said with a chuckle. "But you can't take it personally."

On a recent morning, the dorm appeared relatively clean, quiet and similar to most other housing units at the maximum-security prison in Ridgeville, about 38 miles west of Charleston. The only giveaways to its purpose were newspaper articles about Baxley's ruling that someone taped to a column in the common area and a group therapy session under way down the hall.

Prison officials would not allow a reporter to speak with inmates, but he was allowed to sit in on the therapy session, in which a counselor quizzed 10 inmates in tan jumpsuits about the characteristics separating adults from children. The inmates, huddled around a series of stark metal tables, described adults in terms of discipline and authority while children were seen an naive, noisy and unruly.

The counselor asked them what happens if they are unruly and refuse to go back to their cells or obey orders. Do you they need an adult to discipline them?

"No, we should be acting like adults," one inmate offered.

The counselor smiled.

"That's what I'm trying to get y'all to understand," she said. "You control you, and no other adult can make you act or feel like a child."

The men nodded in agreement.

More to be done

Baxley took note in his ruling of the department's efforts, but he was clearly not impressed, deriding the steps as "half-hearted measures" and "small steps."

Baxley chided the Corrections Department for choosing to fight the lawsuit for so many years rather than address well-identified problems cited by its own experts and others. The agency spent about $800,000 since 2005 fighting the suit, which was filed by the Columbia-based Protection and Advocacy for People with Disabilities.

"Rather than accept the obvious at some point and come forward in a meaningful way to try and improve its mental health system, Defendants have fought this case tooth and nail," the judge wrote in his ruling. "The hundreds of thousands of tax dollars spent on defending this lawsuit, at trial and most likely now on appeal, would be better expended to improve mental health services delivery at SCDC."

Ozmint, who ran the prison system from 2003 to 2011, thinks it's unfair to lay the blame solely on the Corrections Department. He said the courts keep sentencing mentally ill inmates to serve time in a system that the Legislature has underfunded for decades.

"The system is broken down on the outside and it seems fundamentally unfair to look at Corrections and say 'It's all your fault.' I mean, really?" Ozmint said. "I don't think you are going to fix the problem until you take a large view of the problem."

Columbia attorney Stuart Andrews, a lead attorney for the plaintiffs in the prison lawsuit, said the larger problem doesn't excuse the Corrections Department's failure to properly care for its charges and keep pace with improvements prison systems from Mississippi to Maine have made in treating mentally ill offenders.

"There not only needs to be resources, there needs to be a cultural redirection and leadership within the department that recognizes that South Carolina is far behind the times and far behind correctional standards," Andrews said. "Wanting to do better - even if you give them that - is not enough."