Two inmates stabbed three guards at the California Correctional Institution in Tehachapi on Thursday and all state prisons were locked down as a precaution, a corrections official said.

The victims, two sergeants and an officer, were in stable condition at local hospitals, said Terry Thornton, a spokeswoman for the Department of Corrections and Rehabilitation.

The two inmates are affiliated with Southern California prison gangs, she said.

State prisons were to remain locked down until corrections staff could determine whether the stabbing was an isolated incident, Thornton said.

The attackers rushed the guards in an office on the maximum security general population yard shortly after 1 p.m., she said. Two weapons were recovered.

The prison was built to hold about 2,800 inmates, but had some 5,900 as of last year, according to the Department of Corrections Web site. Its custody staff numbers about 1,400.

In April 2005, two Tehachapi guards were stabbed by a prisoner using a homemade weapon but both recovered.

The prison, 40 miles southeast of Bakersfield in Kern County, was the scene of a race riot in February 2005 involving 480 black and Hispanic inmates that left three inmates injured.

The last California prison guard to die in the line of duty was stabbed in January 2005 at the California Institution for Men in Chino. It was the first death of a Department of Corrections guard on duty since 1985.