The officers ran into a Pomona apartment building after a pursuit, chasing a suspect who had just crashed nearby and was barricaded in one of the units.
As they approached, gunfire blasted through a door.
Officer Greggory Casillas, a 30-year-old Upland father just six months on the job, was struck and killed. A second officer was shot in the face trying to save him.
The shooting Friday night led to a standoff that ended about 15 hours later when the suspect, identified by authorities as Isaias De Jesus Valencia, 39, was handcuffed and taken into custody by Los Angeles County sheriff's deputies.
"It's a sad day for our community and a sad day for law enforcement in general," Pomona Police Chief Michael Olivieri told reporters, calling the fallen officer a hero. "He left his family at home to protect yours and his ultimate sacrifice will never be forgotten."
Casillas joined the Pomona Police Department in 2014. He took on different positions — he was a records specialist and jailer before becoming a police recruit — to "better prepare himself to achieve his goal" of becoming an officer.
He was sworn in as a police officer in September. Casillas was nearly finished with his field training when he was killed.
Raised in Los Angeles County, Casillas attended "local colleges and universities," Olivieri said. He is survived by his wife and two children, as well as his parents and two brothers.
At the end of the news conference, sheriff's deputies surrounded Olivieri as he walked away from the crowd. Some patted him on the back.
"It has been a long night," said Los Angeles County Sheriff Jim McDonnell.
According to an acquaintance, the suspected shooter suffers from depression and drug addiction. Valencia served in the U.S. Army and has two children, said Amos Young, who knew the suspect through his father's Pomona church, Kingdom of God Revelation Ministries.
Despite having a home, Valencia often slept on the streets and rejected help from his family, Young said.
Police said the incident began Friday night after they received a call about a reckless driver. The suspect refused to stop, leading police on a pursuit that ended when he crashed into a parked car. The driver then ran into an apartment building.
About 9:10 p.m., dispatchers relayed reports of an officer down in the 1400 block of South Palomares Street near Fernleaf Avenue. A law enforcement source said about 75 officers from several agencies swarmed the scene but were unable at first to move the wounded officers to safety because of gunfire.
A mother and daughter who gave only their first names said they ran out of their apartment after hearing the crash. Marlene, 12, said she saw the suspect exit a truck with a gun tucked under his arm and run into the nearby apartment.
When the gunfire began, Marlene began recording on her cellphone. The video shows Marlene and her mother, Jessica, 29, running for safety as the gunfire continued.
"He's inside," a woman says in the video. "Let's go!"
Marlene said she saw police bring a wounded officer outside and rip off his vest. In the video, an officer is seen giving chest compressions to an officer on the ground. Several officers huddle around them.
Marlene and other neighbors said they spotted a woman they said was the suspect's mother crying and vomiting outside the apartment building before she got into a police SUV.
Ninfa Martínez, who lives in a neighboring complex, said she saw residents running out of the building where the shooting occurred.
"Then I heard some shots and went back running," said Martínez, 24. "It was crazy."
After dawn, Casillas' body was escorted by a police procession from Pomona Valley Hospital Medical Center to the coroner's office. More than a dozen law enforcement vehicles blocked the street in front of the apartment building where the suspect was still barricaded.
A handful of SWAT officers gathered outside the entrance. Every so often, their muffled megaphone calls to the man to come out echoed through the street.
Neighbors, some wrapped in blankets or wearing hooded jackets, watched the scene unfold from behind police tape. A few stood on top of their cars in the rain for a better view when a flash-bang device detonated about 10 a.m. An officer then again ordered the man to exit through the front door.
"Come outside with your hands up," the officer said. "Come on out."
Authorities used tear gas to get the suspect to surrender, but he refused to comply, according to the Sheriff's Department. Deputies with the Special Enforcement Bureau eventually entered the building and deployed a police dog.
After Valencia was apprehended, he was escorted to a waiting patrol car wearing underwear and handcuffs.
He was booked on suspicion of murder and attempting to murder police officers and is being held without bail.
The shooting sparked an outpouring of support from local law enforcement.
"Another hero gone too soon. These tragedies are occurring too often, and the pains of sacrifice will never be forgotten," said LAPD Chief Charlie Beck.
The last law enforcement officer killed in the line of duty in Southern California died a little over a year ago. Whittier Police Officer Keith Boyer was fatally shot while investigating a traffic crash in February 2017.
As the sun set Saturday under steady rain, a few dozen people gathered at Pomona police headquarters for a candlelight vigil. Bouquets of flowers with notes of condolences surrounded a water fountain near the entrance.
Pastors led the group in a prayer for police and Casillas' family.
"In the midst of all of the good, Lord, it now feels like a step back — a setback. We have stood here too many times," said Pastor Rick DeBruyne of Lincoln Avenue Community Church, citing the years when officers were slain in Pomona: 1996, 2004, 2014.
Times staff writer Richard Winton contributed to this report.