SAN BERNARDINO, Calif. (AP) — A motorist arrested in the shooting of a deputy committed suicide at sheriff's headquarters with a handgun he had in his front pants pocket, authorities said.

Ricardo Alfonso Cerna, 47, of San Bernardino was alone in an interview room about 11 a.m. Friday when he shot himself in the head, officials said. Bobby Dean, head of the San Bernardino County sheriff's homicide unit, had stepped out of the room to speak with a detective in the hallway.

Cerna was pronounced dead at the scene.

Deputy Michael Parham, who was shot in the abdomen, underwent surgery at Loma Linda University Medical Center and was listed in critical but stable condition in intensive care.

Authorities said they did not know why Cerna's gun wasn't found when deputies arrested him.