The suspected gunman who allegedly opened fire with an assault rifle on members of a Southern California synagogue during a Passover service -- killing one person and wounding three others, including the rabbi and a child -- has been linked to a recent arson blaze at a nearby mosque, according to a law enforcement source.
John Earnest, 19, was taken into custody after being confronted during Saturday's attack on the Chabad of Poway synagogue near San Diego by an U.S. Border Patrol agent, who is a member of the temple, who shot at the suspect's car as he drove off, officials said.
Earnest has been charged with one count of first-degree murder and three counts of attempted first-degree murder in connection with the shooting.
The synagogue's rabbi, Yisroel Goldstein, told ABC News that the suspects gun jammed during that attack, calling it the "one miracle" that prevented more bloodshed.
The Federal Bureau of Investigation announced Sunday that it was joining the probe, which is being led by the San Diego County Sheriff's Office.
A law enforcement source with direct knowledge of the investigation told ABC News that Earnest has been identified as the suspect in a March 24 arson fire that damaged the Dar-ul-Arqam mosque in Escondido, a San Diego County town about 15 miles north of the synagogue in Poway.
Earnest "is our guy," the law enforcement source said of the arson at the mosque.
In the mosque fire, Earnest, of San Diego, allegedly left behind a note referencing the March 15 attacks on two mosques in Christchurch, New Zealand. A 28-year-old Australian man, Brenton Harrison Tarrant, described by authorities as a white supremacist, allegedly killed 50 Muslim worshipers and broadcast part of the massacre on Facebook Live.
In the Chabad of Poway synagogue attack, Earnest allegedly wore a helmet camera and was attempting to live stream the shooting, but his video equipment apparently failed to function, the source told ABC News.
Prior to Saturday's shooting, Earnest allegedly posted a 4,000-word letter on the dark web, professing to be a white supremacist and expressing hate for Jewish and Muslim people.
Earnest was allegedly inspired by the mass shootings in Christchurch and at the Tree of Life Synagogue in Pittsburgh, where on Oct. 27 suspect Robert Bowers, who had written anti-Semitic and anti-immigrant messages on a website popular with white supremacists, allegedly killed 11 people and wounded seven others.
The attack in Poway occurred exactly six months after the Tree of Life massacre.
"It was only six months ago to the day that we became members of that tragic club of community-based shootings to which no one wants to belong. We know first-hand the fear, anguish and healing process such an atrocity causes, and our hearts are with the afflicted San Diego families and their congregation," reads a statement from the leaders of the Tree of Life Synagogue.
"These senseless acts of violence and prejudice must end. Enough is enough!" reads the statement.
The Chabad of Poway synagogue shooting unfolded about 11:30 a.m. when Earnest allegedly fired at least 10 rounds inside the house of worship with a .223 AR assault rifle he purchased in recent weeks, the law enforcement source told ABC News.
A U.S. Border Patrol agent, whose name has not been released, was a member of the synagogue attending the service when the gunfire erupted. He was one of two men who confronted the gunman and are being hailed as heroes for helping to stop the attack.
Authorities identified the other synagogue member who confronted the suspect as Oscar Stewart, 51.
Stewart chased the gunman out of the synagogue when the suspect's gun jammed, the San Diego Sheriff's Office said in a statement.
"While Mr. Stewart was near the vehicle, an off-duty Border Patrol Agent caught up to the vehicle and yelled for Mr. Stewart to get out of the way," the sheriff's office statement reads. "The Border Patrol Agent then fired a weapon in the suspect's direction striking the vehicle as it drove away. Mr. Stewart risked his life to stop the shooter and saved lives in the process."
The agent, who apparently picked up a gun dropped by another synagogue member, fired at the gunman, missing him but hitting his car as he drove off, authorities said.
Earnest was taken into custody moments later when a K-9 officer saw him nearby, officials said. The suspect jumped out of his car and put his hands up, San Diego Police Chief David Nisleit said during the news conference on Saturday.
Rabbi Goldstein was in in the middle of his sermon on the last day of the Jewish observance of Passover when gunfire broke out, witnesses said.
Lori Gilbert Kaye, 60, a member of the Poway synagogue, was shot in the attack and later died at Palomar Medical Center in Escondido, according to authorities and synagogue officials. Three other people hurt in the attack, including a young girl, were treated for non-life-threatening injuries at Palomar Medical Center, officials said.
All of the surviving victims have been released from the hospital, officials said on Sunday.
Despite being shot in the hand, Rabbi Goldstein continued with his Passover sermon, witnesses told the police.
Minoo Anvari said her husband, who was attending the service, called her from the synagogue immediately after the shooting.
"The rabbi lost two fingers. But in spite of bleeding, he was trying to finish his speech," Anvari said her husband told her. "He was telling all the people who know him, 'Be strong. ... God helps us, God helps [our] country.'"
President Donald Trump praised the border agent for his heroism.
"Sincerest THANK YOU to our great Border Patrol Agent who stopped the shooter at the Synagogue in Poway, California. He may have been off duty but his talents for Law Enforcement weren’t!" President Donald Trump tweeted Saturday.
During a rally in Green Bay, Wisconsin, Saturday night, Trump said, “We forcefully condemn the evil of anti-Semitism and hate. It must be defeated. We will all get to the bottom of it.”
In the letter he allegedly wrote, Earnest made a point of saying he is not a supporter of the president.
John Sanders, acting commissioner of the Customs and Border Protection, said the Border Patrol agent is based in the region.
"We have learned that one of our own off-duty Border Patrol agents was present and took actions that may have prevented additional loss of life," Sanders said in a statement. "CBP will fully support our law enforcement partners who are investigating."
In an interview on ABC's "Good Morning America" on Sunday, Poway Mayor Steve Vaus said his community is responding to the shooting with love.
"You know, our community is doing as well as can be expected, and I just want to say first, our Jewish brothers and sisters from Chabad of Poway have to feel the love all of us are sending their way," Vaus said. "We're a close community and we're going to be for them every step of the way."
He said security is being boosted at houses of worship in the area.
"Every preacher on every pulpit in Poway will talk about this," Vaus said. "It will be on people's hearts and minds, and our law enforcement teams, who have been incredible from the beginning of this, are going to make sure our community is safe."