One suspect in a shooting that killed a San Diego police officer and injured another was in custody Friday following a massive manhunt that included an hours-long SWAT standoff.

San Diego Police Chief Shelley Zimmerman told reporters that 52-year-old Jesse Gomez was arrested and is in critical condition from a gunshot wound. A second possible suspect, 41-year-old Marcus Antonio Cassani, was arrested on an unrelated outstanding warrant and police were investigating whether he was involved in the shooting.  

The Thursday night shooting in a blue-collar section of southeasten San Diego claimed the life of Officer Johnathan "J.D." DeGuzman, 43, and injured Officer Wade Irwin, 32. The officers, veteran members of San Diego Police's gang unit, had stopped a person on a street. Almost immediately, a shootout ensued and the officers called for backup.

The shooting came as departments around the country are on high alert following the killing of officers in Dallas and Baton Rouge, La., this month. However, Zimmerman said it was unknown whether Thursday's shooting was premeditated.

"It happened extremely quickly," Zimmerman said. "From the information that was put out that a stop was being made to that the officers called for emergency cover to when the other officers arrived on scene, we're talking very, very quickly. Seconds to a minute or so."

A male suspect was captured in a nearby ravine and was being treated Friday at a hospital. Police did not identify him but Zimmerman said he was in critical condition with a gunshot wound.

Residents were ordered to stay in their homes throughout the night as San Diego police and officers from other law enforcement agencies scoured yards, streets and alleys for other possible suspects. A helicopter hovered over the neighborhood.

About nine hours after the shootout, heavily armed police officers surrounded a house about a half-mile away, one of them using a bullhorn to urge a man to surrender. Authorities also detonated several devices at the scene to draw him out.

They broke windows and pounded on the roof before entering the house but did not find the possible suspect inside.

Then, about a dozen heavily armed SWAT officers raced two blocks to another house, with an armored truck and robots positioned outside.

Greg Acosta, a 39-year-old electrician who lives at the second home targeted by SWAT officers, found his gates smashed after rushing home from work.

The San Diego Union-Tribune reported that Cassani was arrested while he was standing in the middle of the street near the second house. 

Zimmerman said she worked with DeGuzman before she was promoted to chief in 2014.

"I can tell you he is a loving, caring husband, father. Talked about his family all the time," Zimmerman said. "I know him, and this is gut-wrenching. He cared. He came to work every single day wanting to just make a positive difference in the lives of our community and that's why he lost his life."

After visiting Irwin at UC San Diego Medical Center early Friday, Zimmerman told reporters that the officer's prospects for recovery were good. The nine-year veteran of the force had just joined the gang unit in June.

"It's a little bit of a long haul until he makes a full recovery, but the good news is that he is going to survive and he is going to recover," she said.

San Diego Mayor Kevin Faulconer denounced the shootings.

"I ask all San Diegans and all people across our nation to join together in support of our officers who courageously protect our communities," he added. "We need them and they need us."

The Associated Press contributed to this report.