Late Saturday, the sheriff’s department identified the man they had arrested as Isaias De Jesus Valencia, 39, of Pomona. In a brief statement, the authorities said he would be charged with murder and attempted murder and was being held without bail.

Image Officer Casillas joined the Pomona Police Department in September 2017 and was about to complete his field training. Credit... Pomona Police Department, via Twitter

The shooting occurred shortly after 9 p.m. local time, the authorities said. The episode began after officers from Pomona, a city of about 150,000 people 30 miles outside Los Angeles, responded to a call of a person driving recklessly.

They tried to stop the driver, who led them on a pursuit before crashing into a parked vehicle.

“The suspect fled to a nearby apartment complex where he barricaded himself to a bedroom in one of the apartments,” a news release from the sheriff’s department said. “The officers attempted to contact the suspect when the suspect began to shoot through the door, striking two officers.”

After Officer Casillas was shot, a second Pomona officer tried to pull him to safety but was shot in the face, Sheriff Jim McDonnell of Los Angeles County said during a news conference. Other officers extracted the officers who had been shot.

They were taken to Pomona Valley Hospital Medical Center, where Officer Casillas died. The other officer, who was in serious condition, was undergoing surgery and expected to survive.