Updated

An inmate at a California state prison was shot and killed to stop an attack on another who had fallen to the ground unconscious, unable to defend himself, officials said Wednesday.

A correctional officer first fired a warning shot from his riffle to stop two inmates from attacking the third, said Dana Simas, spokeswoman for the California Department of Corrections and Rehabilitation. When the attack did not stop, the officer fired the fatal round, striking the inmate's chest, said Simas, adding that deadly force was the officer's last resort.

"The loss of any life is unfortunate," she said. "As is the case for all in-custody deaths, this death will be thoroughly investigated."

The shooting happened inside Kern Valley State Prison in rural Delano, about 35 miles north of Bakersfield. The prison holds more than 3,700 inmates.

Officials did not release the names of the inmates or correctional officer. The inmate who was shot had been airlifted to a hospital and later pronounced dead, Simas said. The inmate who was attacked has been taken to a local hospital to be treated for a head injury, she said.

There were no reports of injuries to the second attacker, and a motive remains under investigation, said Simas, adding that no prison staffers were injured.

This incident comes amid an investigation launched Monday, when somebody outside the neighboring North Kern State Prison — also in the city limits of Delano — fired shots into the prison, injuring a correctional officer. Officials said that they have not made any arrests or identified any suspects in Monday's shooting.