SAN FRANCISCO (Reuters) – Federal judges on Monday tentatively ordered California to release tens of thousands of inmates, up to a third of all prisoners, in the next three years to stop dangerous overcrowding.

As many as 57,000 could be let go if the current population were cut by the maximum percentage considered by a three-judge panel. Judges said the move could be done without threatening public safety -- and might improve a public safety hazard.

The state immediately said it would appeal the final ruling to the U.S. Supreme Court.

Trend-setting California, the Golden State, has an immense prison system responsible for nearly 170,000 inmates, and their care has become a major political and budget issue as officials weigh multibillion costs of improved facilities against death and illness behind bars.

State officials say new doctors, nurses and prison rules have improved care and cut the dangers of living behind bars.

Meanwhile California is staggering through budget crisis as its real estate market has collapsed and unemployment has spiked.

The three judges specifically said they planned to order the system, swollen to about double its capacity last year, to cut down to 120 percent to 145 percent of capacity within two to three years. They did not give a target headcount.

APPEAL VOWED

California already houses some inmates out of state. Its main in-state prisons and camps had more than 157,000 prisoners, or 188 percent of capacity, as of the end of January, according to state figures, and a cut to 120 percent of capacity would mean letting go about 57,000 prisoners.

"They've told the state, 'You're going to lose,'" said Alison Hardy, a lawyer with Berkeley, California-based Prison Law Office, which with other attorneys represented plaintiffs who had sued the state over overcrowding in its prisons.

Attorney General Jerry Brown, the former governor, said he would appeal the final ruling to the U.S. Supreme Court.

"This order, the latest intrusion by the federal judiciary into California's prison system, is a blunt instrument that does not recognize the imperatives of public safety, nor the challenges of incarcerating criminals, many of whom are deeply disturbed," he said in a statement.

"There is no doubt that there is room for improvement. But significant progress has been made and is continuing to be made at a cost of billions," he added.

The three judges made the tentative ruling in a bid to get the opposing sides to work together, and they offered a court-appointed settlement referee to aid in discussions.

They did not say when the final ruling would be made but were clear that they considered the system still in trouble despite progress, with inadequate medical facilities and prisoners three to a cell, increasing spread of disease.

"There is no relief other than a prisoner release order that can remedy the constitutionally inadequate medical and mental health care," the panel led by Court of Appeals Judge Stephen Reinhardt, wrote.

"The state has a number of options, including reform of the earned credit and parole systems, that would serve to reduce the population of the prison to whatever percentage is ultimately determined to be appropriate without adversely affecting public safety," the judges wrote.

The panel ordered the state to consult with the prisoners' lawyers to consider what actions to take.

I know the price of concrete has gone up a bit, but it would still be cheaper to build a concrete wall behind every federal courthouse, paint it white, and stand convicted child molestors, drug traffickers, murderers, rapists, and illegals convicted of any violent crime at all in front of it and put a 9mm round in the back of their heads. I volunteer my services, and I'll even provide my own gun and ammo.

"I have always been a soldier. I have known no other life. The calling of arms, I have followed from boyhood. I have never sought another." From The Virtues of War, by Steven Pressfield.