A gunman walked into a San Diego-area synagogue crowded with Sabbath worshippers yesterday and opened fire with an assault-style rifle, killing one woman inside and wounding three others.

The suspect, who fled the scene by car but surrendered to police a short time later, was identified by authorities as John Earnest, 19, of San Diego.

He is the apparent author of a "manifesto" who claimed to have set a nearby mosque on fire last month and professed drawing inspiration from the gunman who killed nearly 50 people at two mosques in New Zealand.

San Diego County Sheriff Bill Gore said police and FBI were investigating Mr Earnest's "possible involvement" in an unsolved predawn arson on 24 March at the Islamic Center of Escondido, a town about 24km north of yesterday’s attack.

We need your consent to load this rte-player contentWe use rte-player to manage extra content that can set cookies on your device and collect data about your activity. Please review their details and accept them to load the content.Manage Preferences

No one was hurt at the mosque fire.

Sheriff Gore said Mr Earnest, whose weapon apparently malfunctioned after the first several rounds he fired, had no prior criminal record.

The gun violence at the Congregation Chabad synagogue in the town of Poway, California, about 37km north of downtown San Diego, unfolded six months to the day after 11 worshippers were killed and six others wounded by a gunman who stormed the Tree of Life synagogue in Pittsburgh yelling, "All Jews must die".

The assailant in that massacre, said to be the deadliest attack ever against Jews on US soil, was arrested.

Poway Mayor Steve Vaus characterised the shooting as a "hate crime," saying his assessment was based on statements uttered by the gunman when he entered the synagogue.

At a news conference later, Sheriff Gore told reporters: "Clearly it's being investigated as a homicide, but we're also looking at the hate crime possible violation as well as federal civil rights violations."

Speaking with reporters at the White House, US President Donald Trump said: "My deepest sympathies go to the people that were affected."

He added that "it looks like a hate crime" and that authorities will "get to the bottom of it".

Sheriff Gore said four people were struck by gunfire and taken to Palomar Medical Center, where one of the victims, an "older woman," died.

The three other patients - "two adult males" and a "female juvenile" - were listed as being in a stable condition, he said.

Authorities later identified one of the victims as the rabbi, who underwent surgery for treatment of "defensive wounds to his index fingers".

The sheriff's office said the two other patients, a 34-year-old man and the girl, were each struck by shrapnel but were "doing well".

Sheriff Gore said an off-duty US Border Patrol agent opened fire on the suspect’s vehicle as it left the scene.

The gunman was arrested a short time later when he gave himself up to police.