A 19-year-old man armed with an assault rifle walked into a suburban San Diego synagogue Saturday morning and opened fire, killing one person and injuring three others, including a child, in a mass shooting that the mayor cast as a “hate crime.”

The San Diego Sheriff's Office said that John Earnest of San Diego had been arrested in connection with the shooting at the Chabad of Poway but they didn't believe there were any other suspects. Police said he has had no prior contact with police and was being questioned by local detectives and local FBI agents Saturday afternoon.

Sheriff William Gore said authorities were looking into a rambling, multi-page manifesto that was published minutes before the shooting by a person with the same name, in which the writer claimed Jews were destroying whites and praised attacks in Pittsburgh and New Zealand.

“We are aware of his manifesto, which we are in the process of reviewing to determine its validity and authenticity,” Gore said, adding that the attack is being investigated as a homicide and authorities are looking into charges that include state hate crimes statutes and federal civil rights violations.

Authorities were also “looking into the possibility” of Earnest's involvement in a mosque fire in nearby Escondido last month, a claim that is made in the manifesto, Gore said.

More lives may have been spared in the shooting thanks to the work of an armed off-duty Border Patrol agent believed to be working as a security guard in the synagogue during the shooting. The guard, who has not been identified, returned fire as the suspect fled to his car, hitting the vehicle with several bullet holes.

Investigators were working to determine if Earnest left the scene because he was engaged by the Border Patrol agent. Gore said there were also some indications that Earnest’s gun “malfunctioned” after he fired several rounds.

“Sadly we are seeing this happen all too often around our country,” Gore said of the shooting. “It’s tragic, especially when it happens here in our own backyard.”

The attack on the 33-year-old synagogue in Poway, a town of about 50,000 people located just northeast of San Diego, took place on the last day of Passover and exactly six months to the day after Robert Bowers, 46, allegedly entered the Tree of Life synagogue in Pittsburgh just after 10 a.m, reportedly shouting “all Jews must die” before opening fire and killing 11 people.

The Chabad center was founded in 1986 as part of the Chabad-Lubavitch Hasidic movement's international outreach efforts. It serves “Jews of all backgrounds who want to learn more about their Jewish roots,” according to their website, and like other Chabad centers, attracts a variety of congregants, many of whom are not traditionally religious.

The congregation according to an event listing was in the midst of a Passover Holiday Celebration that began at 11 a.m. and was set to end at 7 p.m. with a final Passover meal.

It was interrupted around 11:30 a.m. when Earnest allegedly entered the synagogue carrying an AR-15 type assault weapon and opened fire, striking four people, including a woman who was killed and two men and a girl who were all expected to survive.

Police said among those injured was Rabbi Yisroel Goldstein, who was conducting service at the time and was shot in the hand. He was in surgery Saturday and was expected to survive.

Earnest was arrested without incident by San Diego police as he was fleeing the scene, Chief David Nisleit said.

A San Diego police officer en route to the scene overheard on the California Highway Patrol scanner that a suspect had allegedly called 911 to report that he was just involved in this shooting and gave authorities his location, Nisleit said.

As the officer was exiting the freeway, he clearly saw the suspect in his car, Nisleit said. “The suspect pulled over, jumped out of his car with his hands up and was immediately taken into custody,” he said. “As the officer was placing this 19-year-old male into custody he clearly saw a rifle sitting on the front passenger seat of the suspect vehicle.”

The local FBI and ATF offices in San Diego said agents are working with local officials on the investigation.

Poway Mayor Steve Vaus, speaking on CNN, called the attack a “hate crime” based on “statements the shooter made when he entered” the building.

Gore said police have copies of the suspect’s social media posts and an alleged hate-filled manifesto he wrote right before the shooting, which would be reviewed “to determine the legitimacy of it and determine how exactly it plays into the investigation.”

The manifesto reviewed by The Daily Beast was created before the attack and the writer identifies himself as Earnest. A spokesperson for the sheriff's office declined to provide any additional details about the manifesto.

The manifesto was first shared on the toxic trolling board 8chan minutes before the suspect opened fire. It contains apparent misinformation and is clearly meant to be found and disseminated. (It uses the same question-and-answer format as the manifesto of the terrorist who attacked two mosques in Christchurch, New Zealand.)

The writer identifies himself as a Christian of European descent. While he eschews political labels, the writer repeats a far-right accusation that Jews seek to destroy the white race through immigration of non-whites. It is the same purported motive given by the man who allegedly killed 11 Jews at a Pittsburgh synagogue last October.

California State University San Marcos identified Earnest as one of its students in a statement released Saturday evening. “We are heartbroken by this tragedy, which was motivated by hate and anti-Semitism,” the school’s president, Karen Haynes, said, adding that the university is “dismayed and disheartened” by Earnest’s alleged involvement.

Speaking to reporters on the White House lawn, President Donald Trump expressed his “deepest sympathies” to the Poway congregation and “the people that were affected” in what “obviously... looks like a hate crime.”

“We are doing some very heavy research and we will see what comes up but it looks like a hate crime,” Trump said before heading to Wisconsin for a rally in protest of the annual White House Correspondent’s Dinner. “Hard to believe, hard to believe.”