A 19-year-old gunman opened fire inside a synagogue near San Diego as worshippers celebrated the last day of a major Jewish holiday, killing a woman and wounding the rabbi and two others Saturday, authorities said.

President Donald Trump and other elected officials decried what they called an anti-Semitic attack exactly six months since 11 people were killed at a Pittsburgh synagogue in the deadliest assault on Jews in U.S. history.

There were indications an AR-type assault weapon might have malfunctioned after the gunman, identified as John Earnest, fired numerous rounds inside the Chabad of Poway, San Diego County Sheriff William Gore said.

An off-duty Border Patrol agent working as a security guard fired at the shooter as he ran away, missing him but striking his getaway vehicle, San Diego County Sheriff William Gore said.

Shortly after fleeing, Earnest called 911 to report the shooting, San Diego Police Chief David Nisleit said. When an officer reached him on a roadway, “the suspect pulled over, jumped out of his car with his hands up and was immediately taken into custody,” Nisleit said.

The sheriff said a girl and two men, including the rabbi, were wounded as the Jewish congregation gathered for Passover, a weeklong commemoration of the deliverance of the ancient Hebrews from slavery in Egypt. The three were in stable condition at hospitals.

Earnest has no criminal record, but investigators were looking into a claim he made in an online manifesto about setting a fire at a mosque in nearby Escondido last month, Gore said. There was damage but no injuries.

Gore said authorities were reviewing copies of his social media posts and were investigating the attack as a possible hate crime in the city of Poway, just over 20 miles (32 kilometers) north of San Diego.

A person identifying themselves as John Earnest posted an anti-Jewish screed online about an hour before the attack. The poster described himself as a nursing school student and praised the suspects accused of carrying out deadly attacks on mosques in New Zealand last month and at Pittsburgh’s Tree of Life synagogue Oct. 27.

California State University, San Marcos, confirmed Earnest was a student on the dean’s list and said the school was “dismayed and disheartened” that he was suspected in “this despicable act.”

There was no known threat after Earnest was arrested, but authorities boosted patrols at places of worship as a precaution, police said.

Minoo Anvari, a member of the synagogue, told media outlets that her husband was inside during the shooting. She said he called to tell her the shooter was shouting and cursing.

She called the shooting “unbelievable” in a peaceful and tight-knit community.

“We are strong; you can’t break us,” Anvari said.

Donny Phonea, who lives across the street from the synagogue, turned off his power drill and heard someone shout, “Police!” Then he heard three or four shots.

The 38-year-old bank auditor looked over his backyard fence facing the synagogue and saw people hiding behind an electrical box in the parking lot of a neighboring church. At that point, he knew something was “very, very wrong,” went inside and closed his doors and garage.

“I’m a little taken aback,” said Phonea, who moved to Poway two weeks ago. “I moved here because safety was a factor. Poway is very safe.”

Trump offered his sympathies Saturday, saying the shooting “looked like a hate crime.”

“Our entire nation mourns the loss of life, prays for the wounded and stands in solidary with the Jewish community,” Trump said later at a rally in Wisconsin. “We forcefully condemn the evils of anti-Semitism and hate, which must be defeated.”

He praised law enforcement’s “incredible response” and singled out the off-duty Border Patrol agent who “bravely returned fire and helped disrupt the attack and saved so many lives.”

The sheriff said the gun possibly malfunctioned.

The mayor of Poway, who tweeted that he got a call from the president offering help, also denounced what he called a hate crime.

“I want you know this is not Poway,” Mayor Steve Vaus said. “We always walk with our arms around each other and we will walk through this tragedy with our arms around each other.”

Democratic Gov. Gavin Newsom said he joins the community in grief.

“No one should have to fear going to their place of worship, and no one should be targeted for practicing the tenets of their faith,” he said.

___

Nguyen reported from San Francisco.