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 on Saturday, authorities said.
The suspected shooter is also under investigation in connection with an unsolved mosque arson.
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 US 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.
A Jewish leader in the San Diego area identified the victims of the shooting. Lori Kaye, 60, of Poway was killed, Rabbi Yonah Fradkin, executive director of Chabad of San Diego County, said in a statement.
Those injured in the shooting Saturday were Rabbi Yisroel Goldstein, Noya Dahan, 8, and Almog Peretz, 34, he said.
"In the face of senseless hate we commit to live proudly as Jews in this glorious country," Fradkin said. "We strongly believe that love is exponentially more powerful than hate. We are deeply shaken by the loss of a true woman of valour, Lori Kaye, who lost her life solely for living as a Jew."
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 32 kilometres 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 on Oct 27.
He is also believed to be the author of a 'manifesto' who claimed to have set a nearby mosque on fire last month and professed drawing inspiration from the New Zealand mosque attacker.
San Diego County Sheriff Bill Gore said police and FBI were investigating Earnest's "possible involvement" in the March 24 pre-dawn arson fire at the Islamic Center of Escondido, a town about 24km north of Poway. No one was hurt at the mosque fire.
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 neighbouring 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 on Saturday, saying the shooting "looked like a hate crime".
"Our entire nation mourns the loss of life, prays for the wounded and stands in solidarity 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 Governor 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 practising the tenets of their faith," he said.