Suzanne Schneider, the deputy director of the Brooklyn Institute for Social Research, is the author of “Mandatory Separation: Religion, Education, and Mass Politics in Palestine.”

As lawmakers in Washington tried to hammer out an immigration deal Wednesday, Nikolas Cruz was, as police say he admitted Thursday, shooting his former classmates at Marjory Stoneman Douglas High School in Parkland, Fla. It was the 30th mass shooting of 2018, and by now the mourning rituals are routine: Thoughts and prayers are extended, partisans take up their respective places in the gun-control debate, op-eds are penned about the need for sensible policies.

While we are used to approaching America’s gun culture as a singular phenomenon, it is worth considering how it relates to those other headlines about immigration. The latter debate often links borders to questions of safety and security — from President Trump’s assertion that Mexican immigrants are rapists to the language of the original travel ban, which targeted Muslim-majority countries and was titled “Protecting the Nation from Foreign Terrorist Entry into the United States.”

Despite evidence to the contrary (the incarceration rate for native-born Americans is nearly twice that of undocumented immigrants and nearly three times that of legal immigrants), a powerful narrative persists that immigrants are preternaturally violent and that our safety is best guaranteed by closing our doors to anyone with brown skin. Witness the Justice Department’s recent slanted study of immigrant crime or the president’s eagerness to wrongly attribute violence to immigrants, including in the death of a Border Patrol officer in November. (An FBI report this month found no signs of an attack in that incident.) As Trump said in his State of the Union address, “Open borders . . . have caused the loss of many innocent lives.” He cited two teenage girls killed in New York by members of the MS-13 gang, which often recruits immigrant minors; he omitted the victims of the 346 mass shootings that occurred in 2017.

Yet while one hand draws up plans for border walls, the other doles out AR-15s to white, male, homegrown terrorists: Between 54 and 63 percent of the mass shootings since 1982 were committed by white men. A hypothetical outside threat is seen as far more deadly than a very real internal one. How do we account for these seemingly contradictory impulses?

We all tell ourselves stories about who we are, what we do and how we differ from others — markers of distinction that undergird our individual and collective identities. In recent years, for instance, politicians and pundits have gone to great lengths to distinguish “our” violence from “theirs,” referring to Muslims. As is often noted in the wake of mass shootings, white American perpetrators are deemed “troubled” or “disturbed” (as Trump described Cruz on Thursday), while their Muslim counterparts are purportedly motivated by nothing but religious fanaticism. Indeed, the question of mental health rarely seems to enter into the equation when the perpetrator is Muslim. We’ve embraced the false dichotomy: If browser history and social media accounts link a shooter to some form of radical Islam, then he is a terrorist (as in the case of Syed Rizwan Farouk, one of the San Bernardino, Calif., attackers), even though the animating factor may have been mental illness.

But in the wake of Islamic State-linked mass shootings, the distinction between terrorists and homegrown American killers has begun to blur. Orlando’s Omar Mateen and Sandy Hook’s Adam Lanza have more that unites them than divides them. If we look beyond America, we might notice features common among perpetrators across religious and ethnic lines. As Olivier Roy argues in his recent book, “Jihad and Death,” they tend to be young men from middle- or upper-middle-class backgrounds, often with a history of petty crime. Some seem to grapple with social alienation or mental illness, such as Mohamed Lahouaiej Bouhlel, who drove a truck into a crowd in Nice, France, killing 86 people in 2016. “People suffering from psychological troubles can undoubtedly find in the jihadi imaginary a way to situate their madness within a realm of meaning shared by others,” Roy writes; “in other words, to cease being considered mad when their insanity reaches its murderous height, because they will be given the prestigious label of terrorist instead of being called a psychopath.”

This sounds awfully like the musings of Charleston, S.C., church shooter Dylann Roof or Norway’s Anders Breivik, who killed 69 people at a summer camp. Where does a political motive diverge from a delusion? Only in the case of Muslim killers are we confident that we can draw a bright line.

Perhaps most important — and chilling — what links mass shootings is the sense of sheer randomness they invoke. Even when the perpetrators know their victims, as in the shootings in San Bernardino and Fort Hood, Tex., they rarely stop to target foes or spare friends. The mere act of being present makes one a legitimate target. It is this feature of contemporary terrorism — whether in Paris or Parkland — that unites disparate acts of violence and constitutes their prime psychological menace: It could be anyone, anywhere. No guilt is required; your best efforts may not save you. Mass shootings thus represent the total breakdown of correlation between human agency and one’s fate. Survival seems to be a game of pure chance, and it is precisely this horrible truth that makes us quiver.

That truth transcends borders, but Americans continue to embrace the expensive fiction that outsiders are the real threat, with 45 percent of Americans saying immigrants worsen U.S. crime. Even as the Islamic State entreats would-be fighters to take advantage of America’s lax gun laws (“their” domestic attacks depend on “our” policies), our leaders offer “thoughts and prayers” to shooting victims. Meanwhile, they craft vigorous actions against immigrants, such as the Trump administration’s moves to deport undocumented people who appear at court proceedings. A flurry of activity on one front, and nary a suggestion that things might be different on the other. The impulse to close our doors offers a false sense of security — a little reassurance that we can take steps to make ourselves safer — that seems all the more necessary because our hands appear perpetually tied when it comes to gun violence.

Scholars in a range of disciplines — from comparative literature to social theory to psychoanalysis — have long noted the tendency to project our faults on people who seem alien to us. With regard to safety and security, demonizing refugees, Muslims, Mexicans and so on does the important work of seeming to take action while leaving the existing order (and the incredible profits of gun manufacturers) intact. In a world that can undoubtedly feel like a scary place, we might want to believe that our biggest threats come from without. That they might already be walking among us is apparently too much to swallow.

Read more from Outlook and follow our updates on Facebook and Twitter.