When a gunman killed three people and injured 15 others at the Gilroy Garlic Festival last weekend and died at the scene, authorities were left to discern a motive for his attack.

Evidence compiled after the shooting seemed to include some clues: Investigators recovered extremist materials during a search of 19-year-old gunman Santino William Legan’s home in Nevada, according to one law enforcement source, and Legan had posted a photo on Instagram urging people to read a novel widely associated with white supremacists.

The Instagram comments fueled speculation that the crime was motivated by racist ideology. If that turns out to be true — authorities have said a motive remained undetermined — it could mean that the attack fell into the most common category of domestic terrorism: those associated with white supremacy.

John F. Bennett, special agent in charge of the FBI’s San Francisco office, said at a news conference Thursday that it was not clear that Legan was targeting any group in particular and that motive “can be a very tricky thing” to identify.

“It seems very random at this point,” he said of the attack, adding that authorities had not established the ideology, if any, behind it.

Federal and local authorities recently have said there are heightened concerns about domestic terrorism and white supremacy.

In July, FBI Director Christopher A. Wray told the Senate Judiciary Committee that a majority of domestic terrorism cases the bureau has investigated are motivated by white supremacy. Wray said that the FBI was aggressively pursuing domestic terrorism and hate crimes.

“Our focus is on the violence,” he said. “We, the FBI, don’t investigate the ideology, no matter how repugnant. We investigate violence.”

Deadly mass shootings have prompted Congress to scrutinize how resources are allocated for investigating groups that post domestic terrorist threats.

Michael McGarrity, head of the FBI’s counterterrorism unit, in May testified during a congressional hearing that the bureau was investigating about 850 cases of domestic terrorism.

Brian Levin, director of Cal State San Bernardino’s Center for the Study of Hate and Extremism, said it can be difficult to classify attacks. For example, the gunman in the Parkland, Fla., shooting in February 2018 that killed 17 people at Marjory Stoneman Douglas High School fixated on racist imagery, but authorities did not designate the attack as a hate crime, and Levin’s said his center did not include it in a recent report.

Levin said political polarization and a rise of far-right nationalism are contributing to hate crimes around the globe.

“We’re seeing a coalescence of traditional hate crime with political violence,” he said.

Here are examples of attacks in recent years in the U.S. and elsewhere that authorities have linked to white supremacist ideology. The accounts were compiled from law enforcement and media reports.

Six people killed in shooting at a mosque in Quebec City, Canada.

On Jan. 29, 2017, a gunman opened fired during evening prayers at an Islamic Cultural Center, killing six and injuring 19 — one paralyzed for life.

Alexandre Bissonnette, who pleaded guilty to the charges of first-degree murder, was associated with right-wing nationalist positions. He told police he was motivated by Prime Minister Justin Trudeau’s message welcoming refugees after the Trump administration’s travel ban on several Muslim-majority countries.

Van rammed into people outside a mosque in London.

Attacker Darren Osborne drove a rented van into a crowd of Muslims standing outside a mosque in north London in June 2017. The group was gathered around victim Makram Ali, who had collapsed due to a previously existing health condition. Ali was killed and 12 others were injured.

The Crown Prosecution Service prosecuted the case as a terrorist offense because of a handwritten note found in the van used in the attack. The note referred to Muslims as “feral” and said Muslim men were “rapists” who were “preying on our children.” Osborne was sentenced to 43 years in prison.

Charlottesville car attack.

On Aug. 12, 2017, James Alex Fields Jr., a participant in a far-right rally in Charlottesville, Va., drove a car into a crowd of people demonstrating against the white nationalist rally, killing protester Heather Heyer, 32, and injuring dozens of others.

Fields was sentenced to life in prison on federal hate-crime charges.

Far-right groups had gathered in Charlottesville to protest the city’s decision to remove a statue of Confederate Gen. Robert E. Lee. The rally turned violent with street brawls breaking out before the car-ramming attack.

Two shot in a supermarket in Kentucky after man attempts to enter a black church.

Gunman Gregory Bush unsuccessfully attempted to enter the First Baptist Church of Jeffersontown, Ky., a predominantly black church, before killing two people at a Kroger supermarket on Oct. 24, 2018.

Louisville resident Ed Harrell told the Louisville Courier-Journal that as he crouched in the parking lot and grabbed his own revolver, the gunman walked past and said: “Don’t shoot me. I won’t shoot you. Whites don’t shoot whites.”

Bush was indicted on hate-crime and firearm charges. He recently pleaded not guilty to two counts of murder, two counts of wanton endangerment and one count of attempted murder.

11 killed in shooting at the Tree of Life synagogue in Pittsburgh.

Gunman Robert Bowers shouted anti-Semitic slurs as he opened fire inside a Pittsburgh synagogue on Oct. 27, 2018, killing 11 and injuring six others, including four police officers.

For months before the attack, Bowers posted angrily on social media, calling immigrants “invaders” and said Jews were the “enemy of white people.”

Bowers was charged with 29 criminal counts, including obstructing the free exercise of religious beliefs (a hate crime) and using a firearm to commit murder. Bowers pleaded not guilty in February and pretrial motions are scheduled for Aug. 15.

51 killed at two mosques in Christchurch, New Zealand.

Brenton Tarrant, who espoused white nationalist ideology, went on a shooting rampage at two mosques in Christchurch in March, killing 51 people and injuring dozens of others.

Tarrantlivestreamed the shooting and left a 74-page manifesto in which he detailed how he grew to hate immigrants and specifically Muslims, and aimed to kill them and encourage others to do the same.

Tarrant was charged with the murder of 51 people, 40 counts of attempted murder and one terrorism charge.