The governor of California and other leading authorities will be held in contempt of court in 20 days unless they find a way to release thousands of prisoners from the overcrowded state corrections system.

A panel of federal judges gave Gov. Jerry Brown and the state’s top corrections officials an ultimatum this week, ordering they come up with solution to the rampant overcrowding epidemic that has caused critics to condemn the treatment endured by prisoners as “cruel and unusual” — or else face the consequences.

If Gov. Brown and his colleagues cannot come up with a plan in the next three weeks that will slash the number of inmates in the state’s 33 prisons by December, the court says they will take legal action against the officials.

According to a corrections department report released this week, the state prison system presently counts 119,542 inmates as residents of those facilities, or 149.5 percent of the number those buildings were designed to hold. In a 71-page ruling described by the Los Angeles Times as “blistering,” a panel of three judges says that portion must be brought down to 137.5 percent by the end of the year. That could mean releasing roughly 9,500 inmates by December if no other solution is found.

In an opinion piece published in the New York Times this week, the paper’s editorial board notes that 30 percent of the California prison population suffers from mental illness, and that the suicide rate among inmates is nearly twice the national average. Judge Lawrence Karlton of Federal District Court in Sacramento wrote in a filing earlier this month that the treatment subjected on the seriously mentally ill violates prohibitions against cruel and unusual punishment, and that conditions continue to be sub-par despite issuing more than 100 court orders against the prison system in the last 17 years.

All the way back in May 2011, the Supreme Court said California had two years to fix the overcrowding issue, ordering them even then to get the number of inmates held in the state system down to the 137.5 percent figure. Then last August, a federal panel including Judge Karlton said the state was obligated to immediately figure out which prisoners are "unlikely to re-offend or who might otherwise be candidates for early release,” hoping to start shedding numbers then.

The state, wrote the panel in 2012, must take “all steps necessary” to reach the population limit set by the Supreme Court.

But this January, Gov. Brown and Corrections Secretary Jeffrey Beard filed a motion asking for the state to soften the number of inmates that must be released, and threatened to take their appeal to the US Supreme Court if the lesser justices shuts them down.

"The prison emergency is over in California," Brown said at a press conference that month. "California is a powerful state. We can run our own prisons. And by God, let those judges give us our prisons back. We'll run them right,” he said.

The federal panel fired back this week, though, threatening to hold those officials in contempt "individually and collectively” if they cannot immediately find a way that would bring numbers down by December.

"California still houses far more prisoners than its system is designed to house," the judges ruled. "At no point over the past several months have defendants indicated any willingness to comply, or made any attempt to comply, with the orders of this court," they said. "In fact, they have blatantly defied them."

That threat against Brown and company was made reluctantly, wrote the court, "but with determination that defendants will not be allowed to continue to violate the requirements of the Constitution of the United States."

"It's a crushing blow to the governor's efforts to get out from under the population cap," Donald Specter, lead attorney for the Prison Law Office, tells Mercury News. "He's burned whatever bridge there is."