Less than two weeks after a gunman killed more than 50 people at two mosques in New Zealand, law-enforcement officials found a disturbing piece of graffiti outside a San Diego County mosque that had been set on fire. “For Brenton Tarrant -t./pol/,” it read.

The cryptic message, which paid homage to the alleged New Zealand shooter and a dark corner of the internet where such shootings are celebrated, foreshadowed a string of violence.

In...