POMONA, Calif.—A gunman who shot two California police officers, killing one of them, was arrested Saturday after barricading himself in an apartment and holding a SWAT team at bay for more than 15 hours, authorities said.

Police in the city of Pomona tried to stop the man around 9 p.m. Friday after receiving a call about reckless driving, but he refused to pull over and led officers on a pursuit, Los Angeles County sheriff’s officials said. The man crashed during the chase and fled into an apartment complex.

The officers pursued the suspect, who fired through the door, shooting one of the officers, Los Angeles Sheriff Jim McDonnell said. A second officer tried to rescue his wounded comrade and the suspect fired through the door again, striking the officer in the face, the sheriff said.

The suspect, whose name hasn’t been released, was holed up in the apartment for more than 15 hours as a SWAT team used flash-bang grenades and cameras to watch him and crisis negotiators tried to coax him into coming out peacefully.

The man was taken into custody and led out of the building wearing only his underpants.

Pomona Police Officer Gregory Casillas, 30, of Upland, was killed. The other officer was undergoing surgery Saturday but was expected to recover, officials said.

“He left his family at home to protect yours and his ultimate sacrifice will never be forgotten,” Pomona Police Chief Michael Olivieri said at a news conference Saturday afternoon.

Casillas first joined the police department in Pomona, which is 48 kilometres east of Los Angeles, as a records specialist in 2014. He then worked as a jailer and became a sworn police officer in September. He leaves behind a wife and two small children.

Gov. Jerry Brown ordered flags at the Capitol to fly at half-staff and said Casillas’ “brave sacrifice will never be forgotten.”

Outside the Los Angeles County coroner’s office, dozens of police cars lined the streets and officers saluted as the slain officer’s body was brought there in a procession Saturday morning.