A stabbing attack last week on four guards at one overcrowded state prison and a racially sparked brawl at another mark the type of violence that guards, inmates' attorneys and Gov. Arnold Schwarzenegger have been worried about for years.

The violence comes at a critical juncture for the nation's largest state-prison system.

Later this year, a panel of federal judges will consider whether the crowding has become so severe that the state must cap the inmate population or release some prisoners early.

Lawmakers are considering a Schwarzenegger proposal to save money for the deficit-ridden state by releasing more than 20,000 inmates before their sentences end.

"For the last two years, we've said something worse than this was inevitable," said Chuck Alexander, executive vice president of the California Correctional Peace Officers Association, referring to last week's prison unrest. "It's just a matter of where and when it's going to hit. In our view, it's a precursor of what's to come."

On Thursday, two inmates armed with homemade knives attacked guards at the California Correctional Institution about 40 miles southeast of Bakersfield. One of the guards was hospitalized with a skull fracture and stab wounds.

A second attack erupted Friday. A dozen inmates were injured during a brawl in a crowded dormitory at the California Institution for Men in Chino, about 40 miles east of Los Angeles. A statewide lockdown was lifted Friday afternoon.

"There's more violence. The prisoners are unsafe, and there is less safety for the officers, as well," said Don Specter, director of the nonprofit Prison Law Office in San Rafael.

He is among inmates-rights attorneys asking the panel of three federal judges to order the state to reduce the prison population. In an unusual alliance, the prison-guards union has joined the push.

Schwarzenegger opposes a federally mandated population cap. But the Republican governor is proposing the early release of some 22,000 inmates and eliminating about 4,500 prison-guard positions to help shave $400 million from the budget of the state corrections department.

Michael Bien, whose San Francisco law firm also is seeking a reduced inmate population, said the early-release plan is irresponsible because guards already are working large amounts of overtime and are under mounting stress.

Schwarzenegger spokeswoman Lisa Page said the governor's plan would retain the current guard-to-inmate ratio while freeing space for rehabilitation programs.

California's 33 prisons have a capacity of roughly 100,000 inmates but hold about 170,000. A commission advised Schwarzenegger in 2004 that the prisons could safely hold about 135,000.

The conditions are blamed for a variety of problems, including poor inmate medical care and mental-health services, that have prompted inmates and advocacy groups to file numerous lawsuits.

Some of those lawsuits eventually led to federal-court oversight and the three-judge panel that will consider how to address the array of difficulties this summer.