LOS ANGELES — A former Los Angeles City Council member who founded a popular non-profit that helps low-income residents is being hailed as a hero after a gunman ambushed an officer Friday and briefly detained him as he investigated an unrelated call.

“God bless Deputy Llewellyn!!” wrote Los Angeles police Officer Larry Rosansky. “Huge thank you and prayers to Deputy & the family of LAPD Deputy Llewellyn. It was an unpredictable & unplanned encounter. Can’t thank Officer enough for helping put the safety of Deputy & his family first.”

But Officer Montecillo said that he thought Llewellyn’s wife and children would be able to have a “normal life after” his police career was over.

Police previously said that with Llewellyn and the woman near a Century City home near Compton, a gunman ambushed them in a run-in over an outstanding warrant. The gunman apparently tried to get into an SUV driven by the department’s Special Response Team vehicle. But the five officers surrounded the car, immobilizing it, and detained him.

When officers later spotted the car, they stopped it at a crosswalk and a white Ford Explorer pulled alongside. The Explorer ran off and Llewellyn was dragged along with the gun.

This is Llewellyn’s first name. His first name is Latin for light.

“It was kind of a blur,” Llewellyn told officers later, the Los Angeles Times reported. “I was surprised. I just wanted to get out of the car and run away from this guy.”

Llewellyn told reporters that the gunman had approached him several times and said, “Get out of here, you’re an old man, you don’t know me.” Llewellyn said he was not sure if the man was a gang member.

He told officers that he had been with a group of teenagers during the Los Angeles riots that followed the passage of the nation’s worst laws against illegal gun use in 1975. But he later decided that it would be better for them to become policemen.

Llewellyn was a first responder to the April 1998 flood that overwhelmed Los Angeles Harbor, killing 150 people. He is also a retired Marine who lives in Santa Monica.

“You don’t get shot multiple times in Hollywood and you don’t get ambushed in the city that I grew up in,” he said, referring to Compton. “So I made sure they were taken care of.”

Police Superintendent Michael Higgins said the unnamed gunman was a veteran of the Korea and Vietnam wars who had a criminal record and had been driving a stolen vehicle. Llewellyn and the couple had a 10-year-old daughter.

Higgins said the suspect had been cited at least once before for possession of a controlled substance.

“It’s tragic. It’s truly tragic,” he said.