(Reuters) - The rabbi wounded in Saturday’s deadly shooting at his Southern California synagogue praised an off-duty U.S. Customs and Border Patrol agent who fired at the fleeing suspect.

Police secure the scene of a shooting incident at the Congregation Chabad synagogue in Poway, north of San Diego, California, U.S. April 27, 2019. REUTERS/John Gastaldo

“I had spoken to him in the past about coming to the synagogue armed because he’s trained, and I want trained security as much as possible,” Rabbi Yisroel Goldstein told CNN, speaking from a local hospital. “Unfortunately, we couldn’t afford to have an armed security officer at every service, so whenever we had extra help, we were grateful for it.”

The agent, named by the rabbi as Jonathan Morales, had recently discovered his Jewish heritage and traveled more than 100 miles (160 km) each way to visit the synagogue from his home in El Centro, a city on the border with Mexico, the rabbi said.

The sheriff of San Diego County, Bill Gore, told reporters on Saturday the officer fired as the gunman was fleeing, missing the suspect but hitting his car.

Police said on Sunday that Oscar Stewart, a 51-year-old worshipper from nearby Rancho Bernardo, saved lives by rushing at the gunman and chasing him to his car outside.

“While Mr. Stewart was near the vehicle, (the) off-duty Border Patrol Agent caught up to the vehicle and yelled for Mr. Stewart to get out of the way,” Gore said in a statement.

“Stewart risked his life to stop the shooter and saved lives in the process.”

One woman was killed and three others wounded, including the rabbi, who lost a finger and had surgery to try to save more of his hand.

Shortly after the shooting, the suspected gunman, 19-year-old John Earnest, called police to say he was involved and then surrendered on a highway in nearby Rancho Bernardo.

Earnest appears to be the author of a “manifesto” posted online who claimed to have set fire to a mosque last month and drew inspiration from last month’s mass shooting at two mosques in New Zealand that killed 50 people.

U.S. President Donald Trump praised Morales, writing on Twitter: “He may have been off duty but his talents for Law Enforcement weren’t!”

“Hate and violence against anyone because of their race, ethnicity or religion has no place in our society,” senior Customs and Border Protection official John Sanders said in a statement.