KENT EKEROTH, a 34-year-old member of parliament for the far-right Sweden Democrats (SD) party, has a pithy response to the idea that immigration can be good for a country: “Bullshit.” Mr Ekeroth’s party would like to block any more refugees from coming to Sweden and kick out many of those who have come already. Most migrants, Mr Ekeroth thinks, are in Sweden to take advantage of its welfare system. That money should be spent on Swedes, he feels.

Opinions of this sort used to be marginal in Sweden. For years the country has taken pride in accepting more refugees per person than any other in Europe. In the 2006 election the SD, which once had ties to neo-Nazi groups, drew just 2.9% of the vote. But in last year’s election it won 13%, and recent polls give it 20% or more, making it the country’s biggest or second-biggest party. It is expanding beyond its working-class base, attracting supporters who have been to university. In multicultural Stockholm, bien-pensant yuppies anxiously confess that childhood friends now support the SD.

As with Sweden, so with Europe. Across the continent, right-wing populists are gathering steam. This year’s migrant influx has proved a huge boon to politicians hostile to Islam, immigration and the European Union. The attacks in Paris on November 13th have added fear of terrorism to the mix. In France the National Front (FN) took 28% of the vote in the first round of regional elections (see article). In Poland voters have tossed out a pro-European centrist government in favour of the religious-nationalist Law and Justice (PiS) party. Besides Sweden, anti-immigrant parties are at or near the top of the polls in the Netherlands, and governing or sharing power in Denmark and Hungary. In country after country, fringe movements are entering the mainstream, firing up voters who feel despised by governing elites, and threatening to scramble the European project.

Anti-immigrant populism in Europe is newly powerful, but it is not new. Many of today’s groups date back to the 1990s, when Europe’s debates about Islam and integration began to heat up. By the late 2000s their support had largely stalled. The start of the euro crisis in 2011 re-energised them. The share of the vote won by France’s Eurosceptic FN declined between 2003 and 2011, but began to climb in 2012. In the Netherlands, Geert Wilders switched his main target from Islam to the EU’s bail-out of Greece. By 2013 Germany had its own right-wing populist party, Alternative für Deutschland (AfD), which called for breaking up the euro.

The euro crisis boosted the populist vote because it hit specific groups of voters especially hard. Support for xenophobic populism is strongest among those who are older, non-university-educated, working-class, white and male (see chart). These voters do not think they benefit much from EU membership, but they certainly felt the effects of the crisis: tax hikes, benefit cuts and unemployment. Populists blamed austerity measures on untrustworthy Greeks and Spaniards, or on the EU’s strict budget-deficit limits, or both.

As refugees poured into Europe this year, right-wing populists switched back to denouncing immigration. Television footage of chaos at the border served as perfect campaign propaganda. In Sweden 180,000 asylum-seekers have arrived in 2015; some are being put up in school halls or sleeping outside in tents. In Germany, schools and municipal governments have strained to handle an influx that has reached 1m this year. The AfD had floundered after a split this summer between its anti-euro and anti-Muslim wings. But the refugee crisis saved the party; polls now put its support at between 6% and 11% nationally. In Italy the migrant crisis has created opportunities for the formerly secessionist Northern League. Under its young leader, Matteo Salvini, the once struggling party has transformed itself into an anti-immigrant group along the lines of the FN, pulling itself back up to 16% in the polls. In June Mr Salvini responded to Pope Francis’s calls to welcome refugees by acidly demanding how many migrants the Vatican City has accepted (other than the pope himself, presumably). Crucially, the populists offer more than just opposition to immigrants and Islam. Most combine cultural conservatism with left-wing economic policies that please their older, less-educated supporters. Poland’s PiS is lowering the retirement age and promising state aid for the country’s inefficient coalminers. France’s FN supports a lower retirement age and more protectionist agricultural policies. Mr Wilders demands that money now spent to house migrants be spent on cancer treatment for Dutch citizens. Two exceptions are the Swiss People’s Party and the AfD, both liberal opponents of large welfare states. (Asked recently whether she would collaborate with Marine Le Pen, the AfD’s leader, Frauke Petry, answered with surprise that the FN is “a largely socialist party” whereas her party believes “in freedom and personal responsibility”.) But most right-wing populist parties are more like PiS, the FN or Mr Wilders’ Party for Freedom (PVV): they “like certain parts of the welfare state, but only for natives,” says André Krouwel of the Free University in Amsterdam. Governments that offer benefits to refugees but subject their own citizens to austerity play into the populists’ hands.

Grumbling that refugees are treated better than citizens was once frowned upon in Sweden. The Sweden Democrats do not care. “We say what people think,” says Julia Kronlid, an SD deputy. This is another shared trait of Europe’s right-wing populists: the belief that rather than expressing obnoxious prejudices, they are voicing truths which others are too politically correct to admit. Both Ms Le Pen and Mr Wilders faced hate-speech trials this year, one for comparing Muslim street prayers to the Nazi occupation, the other for calling for “fewer Moroccans” in the Netherlands. (“He tells it like it is. Speaks truth to power, you know?” says a PVV-voting construction worker in Amsterdam.) Trying to ban such speech feeds the populists’ persecution complex, confirming their supporters’ sense that the political elite is trying to exclude them.

In this, if nothing else, the populists are right. In many countries, the political elite has been excluding them for decades, and still is. In France the Socialists have withdrawn in three regions to give their Republican rivals a better chance of beating the FN in the election’s second round. In Sweden mainstream politicians shun the populists; the right and left blocs made a pact in 2014 that neither would form a coalition with the SD. In a suburb near the city of Malmo, where support for the SD is strong, Madeleine, a 27-year-old electrical-store clerk, finds this disgusting: “This country is not a democracy. More like a dictatorship.”

If populists were included in government instead of shut out, some argue, their approval would fall as they were forced to compromise and take responsibility for failures. The Finns Party has been in government since May; its support has dropped from nearly 18% to about 9%, thanks to Finland’s miserable economy.

Why Serbia and Spain are immune

But including them in government does not necessarily dampen their support, argues Cas Mudde, an expert on European right-wing populists. The Danish People’s Party is supporting its country’s governing coalition; it has never been more powerful or popular. The Swiss People’s Party has been in government since the 1990s, and won 29% of the vote in the most recent election. Fidesz, the party of Hungarian prime minister Viktor Orban, has been in power since 2010. This summer Mr Orban carried out the most radical anti-immigrant policy in Europe: he built a fence to keep them out. His popularity has soared from 28% in April to 43% in October.

The European countries where anti-immigrant populism has failed to take hold are sometimes surprising. The western Balkan states, with their history of nationalist violence, are fertile ground for xenophobia. Yet in 2015 hundreds of thousands of migrants have trooped through Macedonia, Serbia, Croatia and Slovenia with no local political reverberations whatsoever.