On July 14, 2016, as French families strolled along Nice’s seafront promenade, a Tunisian man driving a large truck rammed into a crowd, killing 86 people. A month later, the mayor of nearby Cannes declared that “burkinis” — a catchall term for modest swimwear favored by many religious women — would be banned from the city’s beaches; a municipal official called the bathing suits “ostentatious clothing” expressing an “allegiance to terrorist movements that are at war with us.”

One of the law’s first victims was a third-generation Frenchwoman who was ordered by the police to strip off her veil while onlookers shouted, “Go back to your country.” Still, many French politicians and intellectuals rushed to defend the ban. The former president Nicolas Sarkozy called modest swimwear “a provocation”; Alain Finkielkraut, a prominent philosopher, argued that “the burkini is a flag.” But what they presented as a defense of secular liberal values was in fact an attack on them — a law, masquerading as neutral, had explicitly targeted one religious group.

When rapid immigration and terrorist attacks occur simultaneously — and the terrorists belong to the same ethnic or religious group as the new immigrants — the combination of fear and xenophobia can be dangerous and destructive. In much of Europe, fear of jihadists (who pose a genuine security threat) and animosity toward refugees (who generally do not) have been conflated in a way that allows far-right populists to seize on Islamic State attacks as a pretext to shut the doors to desperate refugees, many of whom are themselves fleeing the Islamic State, and to engage in blatant discrimination against Muslim fellow citizens.

But this isn’t happening only in European countries. In recent years, anti-immigration rhetoric and nativist policies have become the new normal in liberal democracies from Europe to the United States. Legitimate debates about immigration policy and preventing extremism have been eclipsed by an obsessive focus on Muslims that paints them as an immutable civilizational enemy that is fundamentally incompatible with Western democratic values.