AFTER the sans culottes rose up against Louis XVI in 1789 they drew up a declaration of the universal rights of man and of the citizen. Napoleon’s Grande Armée marched not just for the glory of France but for liberty, equality and fraternity. By contrast, the nationalism born with the unification of Germany decades later harked back to Blut und Boden—blood and soil—a romantic and exclusive belief in race and tradition as the wellspring of national belonging. The German legions were fighting for their Volk and against the world.

All societies draw on nationalism of one sort or another to define relations between the state, the citizen and the outside world. Craig Calhoun, an American sociologist, argues that cosmopolitan elites, who sometimes yearn for a post-nationalist order, underestimate “how central nationalist categories are to political and social theory—and to practical reasoning about democracy, political legitimacy and the nature of society itself.”

It is troubling, then, how many countries are shifting from the universal, civic nationalism towards the blood-and-soil, ethnic sort. As positive patriotism warps into negative nationalism, solidarity is mutating into distrust of minorities, who are present in growing numbers (see chart 1). A benign love of one’s country—the spirit that impels Americans to salute the Stars and Stripes, Nigerians to cheer the Super Eagles and Britons to buy Duchess of Cambridge teacups—is being replaced by an urge to look on the world with mistrust. Some perspective is in order. Comparisons with the 1930s are fatuous. Totalitarian nationalism is extinct except in North Korea, where the ruling family preaches a weird mixture of Marxism and racial purity, enforced with slave-labour camps for dissidents. And perhaps you could add Eritrea, a hideous but tiny dictatorship. Nonetheless, it is clear that an exclusive, often ethnically based, form of nationalism is on the march. In rich democracies, it is a potent vote-winner. In autocracies, rulers espouse it to distract people from their lack of freedom and, sometimes, food. The question is: where is it surging, and why? The most recent example is Donald Trump, who persuaded 61m Americans to vote for him by promising to build a wall on the Mexican border, deport illegal immigrants and “make America great again”. Noxious appeals to ethnic or racial solidarity are hardly new in American politics, or restricted to one party. Joe Biden, the vice-president, once told a black audience that Mitt Romney, a decent if dull Republican, was “gonna put y’all back in chains”. But no modern American president has matched Mr Trump’s displays of chauvinism. That no one knows how much of it he believes is barely reassuring. His victory will embolden like-minded leaders around the world. Nigel Farage of the UK Independence Party (UKIP), the politician most responsible for Brexit, has already visited Mr Trump, greeting him with a grin wide enough to see off the Cheshire cat. Viktor Orban, Hungary’s immigrant-bashing prime minister, rejoiced: “We can return to real democracy... what a wonderful world.”

The consequences for the European Union could be disastrous. In France pollsters no longer dismiss the possibility that Marine Le Pen, the charismatic leader of the National Front (FN), could be elected president next year. Compared with other Europeans, French voters are strikingly opposed to globalisation and international trade, and few think immigrants have had a positive effect on their country (see chart 2). Ms Le Pen promises that she would pull France out of the euro and hold a “Frexit” referendum on membership of the EU. The single currency might not survive a French withdrawal. And if French voters were to back Frexit, the EU would surely fall apart.

The rush for the exit

European elites once assumed that national identities would eventually blend into a continental bouillabaisse. But the momentum is now with parties like the FN, including Hungary’s Fidesz, Poland’s Law and Justice party and Austria’s Freedom Party (one of whose leaders, Norbert Hofer, could win Austria’s largely ceremonial presidency next month). Ms Le Pen’s language is typical. She caters to nostalgia, anxiety and antipathy to the liberal international order. (“No to Brussels, yes to France”, goes one slogan.) She laments the decline of a proud people and vows to make France great again.

Unlike Mr Trump, Ms Le Pen has never called for a ban on Muslims entering the country; rather, she talks about curbing the “gigantic wave” of immigration. A lawyer by training, she defends her arguments with reference to France’s rules on keeping religion out of public life. Yet her voters are left in little doubt as to which sorts of immigrants she disapproves of, and whom she counts as French. An FN campaign poster for regional elections in 2015 showed two female faces: one with flowing hair and the French tricolour flag painted on her cheeks, the other wearing a burqa. “Choose your neighbourhood: vote for the Front”, ran the text.

Ms Le Pen’s popularity has dragged other politicians onto similar territory. Nicolas Sarkozy, a centre-right former president, wants the job again. As soon as you become French, he declared at a recent campaign rally, “your ancestors are Gauls.” At another, Mr Sarkozy said that children who did not want to eat pork at school should “take a second helping of chips”—in other words, that it was up to non-Christians whose religions impose dietary restrictions to make do with the food on offer, not up to schools to accommodate them. France is witnessing a “defensive nationalism”, says Dominique Moïsi of the Institut Montaigne, a think-tank, “based on a lack of confidence and a negative jingoism: the idea that I have to defend myself against the threat of others.”

Something similar is on the rise elsewhere in Europe, too. In 2010 the Sweden Democrats (SD), a nationalist party, put out a television ad that captured the popular fear that Sweden’s generous welfare system might not survive a big influx of poor, fertile Muslim asylum-seekers. An elderly white woman with a Zimmer frame hobbles down a dark corridor towards her pension pot, but is overtaken by a crowd of burqa-clad women with prams, who beat her to the money. At least one channel refused to air it, but it spread online. Polls suggest the SD is now one of Sweden’s most popular parties.

In the Netherlands Geert Wilders, the leader of the anti-Muslim, anti-immigrant Party for Freedom, is on trial for “hate speech” for goading his audience to chant that it wanted “fewer Moroccans” in the country. Polls put his party in first or second place in the run-up to the national election in March; its popularity has risen since the start of the trial.

Britain’s vote in June to leave the EU was also the result of a nationalist turn. Campaign posters for “Brexit” depicted hordes of Middle Eastern migrants clamouring to come in. Activists railed against bankers, migrants and rootless experts; one of their slogans was “We want our country back”. After the vote David Cameron, a cosmopolitan prime minister, resigned and was replaced by Theresa May, who says: “If you believe you’re a citizen of the world, you’re a citizen of nowhere. You don’t understand what the very word ‘citizenship’ means.”

Even before Britain has left the EU, the mere prospect has made the country poorer: the currency is down 16% against the dollar. Still, few Brexiteers have regrets. In Margate, a seaside town full of pensioners, it is hard to find anyone who voted to remain. Tom Morrison, who runs a bookshop, says: “[We] should be allowed to make our own laws…At least our mistakes will be our own mistakes.”

Clive, a taxi driver, is more trenchant. “All the Europeans do is leech off us. They can’t even win their own wars,” he says. He is glad that Mrs May has promised to reduce immigration: “We just physically haven’t enough room for them…The schools are overfilled with foreigners.” He adds that some of them are hard workers, but “in Cliftonville [next to Margate], you might as well be in Romania. A lot of them are gypsies.” Asked if being British is important to him, he declares a narrower identity: “It’s being English. English.”

Vladimir Putin, Russia’s president, is not sure what to make of Mr Trump. Though he doubtless welcomes Mr Trump’s promise to reset relations with Russia, if America ceases to be the enemy, he will need another one. Mr Putin’s core belief is in a strong state led by himself, but since he first took power in 2000 he has harnessed ethnic nationalism to that end. In 2011 he faced huge protests from an urban middle class angry about both corruption and uncontrolled immigration by non-Slavic people. He responded by whipping up imperial fervour. When Ukraine sought to move closer to the West, he then annexed Crimea and invaded Eastern Ukraine. State media portrayed him as saving ethnic Russians from (historical) “Ukrainian fascists”.

With oil prices low, and after a long spell in the economic doldrums, nationalism is Mr Putin’s way of remaining popular. His version involves rejecting the universal, liberal values that the West has long promoted. That is why he so eagerly supports illiberal nationalist parties in Western Europe, such as Ms Le Pen’s FN. “We see how many Euro-Atlantic countries are in effect turning away from their roots, including their Christian values,” he said in 2013. He contrasted this with an ethnically defined version of Russia as “a state civilisation held together by the Russian people, the Russian language, Russian culture and the Russian Orthodox Church”.

In China a similarly ethnic, non-universalist nationalism is being pressed into service by the Communist Party (see Briefing). The party seeks to blur the distinction between itself and the nation, and to prop up its legitimacy now that economic growth, long the main basis of its claim to power, has slowed. Soon after becoming president in 2012, Xi Jinping launched the “Chinese Dream” as a slogan to promote the country’s “great revival”. A “patriotic education” campaign extends from primary school all the way up to doctoral students.

The government often blames “hostile foreign forces” for things it does not like, including protests in Hong Kong or Xinjiang, a far-western province where Uighurs chafe against Han rule. State television tries to make other countries look stupid, dangerous or irrelevant. Anti-Western rhetoric has been stepped up. In 2015 China’s education minister called for a ban on “textbooks promoting Western values” in higher education.

China’s glorious victory over Japan has become central to history lessons (though in fact it was the communists’ rivals, the Kuomintang, who did most of the fighting). In 2014 three new national holidays were introduced: a memorial day for the Nanjing massacre, commemorating the 300,000 or so people killed by the Japanese there in 1937; a “Victory Day” to mark Japan’s surrender at the end of the second world war; and “Martyrs’ Day” dedicated to those who died fighting Japan.

My enemy’s enemy

Perhaps unsurprisingly, given the jingoism, many Chinese now see international affairs as a zero-sum game, believing that for China to rise, others must fall. A recent poll by Pew found that more than half of those asked reckoned that America is trying to prevent China from becoming an equal power; some 45% see American power and influence as the greatest international threat facing the country. Chinese antipathy towards the Japanese has also increased considerably.

The propaganda has been so effective that the government is no longer sure that it can control the passions it has stoked. In 2012 protests erupted across China against Japan’s claims to islands in the East China Sea: shops were looted, Japanese cars destroyed and riot police deployed to protect the Japanese embassy in Beijing. The government now censors the angriest online posts about nationalist topics.

Abdel-Fattah al-Sisi, Egypt’s authoritarian president, uses all the resources of the state to promote the idea that he is the father of his country. His regime blames Islamists for everything: when heavy rains caused flooding in Alexandria last year, the interior ministry blamed the Muslim Brotherhood, a banned Islamist group, for blocking the drains. Last summer, after splurging $8bn on expanding the Suez Canal, he declared a public holiday and sailed up the waterway in full military regalia, as warplanes flew overhead. State television broadcast shots of the new canal to the bombastic theme tune of “Game of Thrones”, a television show.

A similar story is playing out in Turkey, a country that only a few years ago appeared firmly on course to join the EU. Now its president, Recep Tayyip Erdogan, vows to build a “New Turkey”, bravely standing up to coup-plotters and their imaginary Western enablers. He recently attended a mass rally celebrating the conquest of Constantinople in 1453. He accuses Turkey’s duplicitous Western allies of trying to “pick up the slack of crusaders”. Such rhetoric is intended to justify the arrests of 36,000 people since a coup attempt in July.

In India ethnic nationalism, never far beneath the surface, is worryingly resurgent. Since 2014 the country has been ruled by Narendra Modi of the Hindu-nationalist Bharatiya Janata Party (BJP). The party seeks to distance itself from radical Hindutva (Hindu nationalist) groups, which criticise it as “soft” on Pakistan, Muslims and those who harm cows (which are sacred to Hindus). And Mr Modi is urbane, pro-business and friendly towards the West. But he is also a lifelong member of the RSS (National Volunteer Organisation), a 5m-strong Hindu group founded in 1925 and modelled loosely on the Boy Scouts.

Members of the RSS parade in khaki uniforms, do physical jerks in the morning, help old ladies cross the street, pick up litter—and are occasional recruits for extremist groups that beat up left-wing students. And last year Mr Modi’s minister of culture, Mahesh Sharma, said that a former president was a patriot “despite being a Muslim”. The minister remains in his job.

Hindutva purports to represent all Hindus, who are four-fifths of India’s population. It promises a national rebirth, a return to an idealised past and the retrieval of an “authentic” native identity. Its adherents see themselves as honest folk fighting corrupt cosmopolitans. They have changed India’s political language, deriding “political correctness”, and calling critical journalists “presstitutes” and political opponents “anti-national”. The RSS also exerts huge sway over education and the media. Some states and schools have adopted textbooks written by RSS scholars that play up the role of Hindutva leaders and marginalise more secular ones.

The BJP has made a big push to control the judiciary by changing rules for appointments, but has met strong resistance. It does not control most states in the east and south. Many of the educated elite despise it. And banging on too much about Hinduism and not enough about the economy is thought to have cost it a state election in Bihar last year.

So India will not slide easily into Turkish-style autocracy—but plenty of secular, liberal Indians are nervous. The police, especially, are thought to favour the ruling party. A reporter nabbed by cops for the “crime” of filming angry crowds outside a bank in Delhi this week says they threatened him with a beating and said: “Who gave you permission to film? Our government has changed; you can’t just take pictures anywhere you like any more.”

Nations once again

Inquiring after the roots of nationalism is like asking what makes people love their families or fear strangers. Scholars have suggested that nations are built around language, history, culture, territory and politics without being able to settle on any single cause. A better question is: what turns civic nationalism into the exclusive sort? There are several theories.

In rich countries, pessimism plays a role. As chart 3 shows, slower growth lowers support for globalisation. Inequality hurts, too. Educated people may be doing just fine, but blue-collar workers are often struggling. Mr Trump did remarkably well among blue-collar white voters. One of the best predictors of support for Brexit or Ms Le Pen is a belief that things were better in the past.

In developing countries, growth is often faster and support for globalisation higher. But people still have woes, from rapacious officials to filthy air. For the new-nationalist strongmen such as Mr Sisi and Mr Putin, nationalism is a cheap and easy way to generate enthusiasm for the state, and to deflect blame for what is wrong.

The new nationalism owes a lot to cultural factors, too. Many Westerners, particularly older ones, liked their countries as they were and never asked for the immigration that turned Europe more Muslim and America less white and Protestant. They object to their discomfort being dismissed as racism.

Elite liberals stress two sources of identity: being a good global citizen (who cares about climate change and sweatshops in Bangladesh) and belonging to an identity group that has nothing to do with the nation (Hispanic, gay, Buddhist, etc). Membership of certain identity groups can carry material as well as psychological benefits. Affirmative action of the sort practised in America gives even the richer members of the racial groups it favours advantages that are unavailable to the poorer members of unfavoured groups.

Nationalists dislike the balkanisation of their countries into identity groups, particularly when those groups are defined as virtuous only to the extent that they disagree with the nation’s previously dominant history. White Americans are starting to act as if they were themselves a minority pressure group.

Lastly, communication tools have accelerated the spread of the new nationalism. Facebook and Twitter allow people to bypass the mainstream media’s cosmopolitan filter to talk to each other, swap news, meet and organise rallies. Mr Trump’s tweets reached millions. His chief strategist, Steve Bannon, made his name running a white-nationalist website. For Mrs May’s “citizens of nowhere”, all this is deeply worrying. But they should not despair. Liberals can use social media, too. Demagogues fall from favour when their policies fail to bring prosperity. And demographic trends favour pluralism. In many countries the university-educated population—typically cosmopolitan in instinct—is rising. In the post-war period about 5% of British adults had gone to university; today more than 40% of school-leavers are university-bound. In Germany 2m citizens were in tertiary education in 2005; a decade later that number had risen to 2.8m. The share of 18- to 24-year-old Americans in that category rose from 26% in 1970 to 40% in 2014.

And immigration, which has done much to fuel ethnic nationalism, could, as generations are born into diverse societies, start to counter that nationalism. The foreign-born population of America rose by almost 10m, to 40m in the decade to 2010. In Britain it rose by 2.9m, to 7.5m, in the decade to 2011. Western voters aged 60 and over—the most nationalist cohort—have lived through a faster cultural and economic overhaul than any previous generation, and seem to have had enough. Few supporters of UKIP and the FN are young; the same is true for Alternative for Germany, another anti-immigrant party (see chart 4).

But youngsters seem to find these changes less frightening. Although just 37% of French people believe that “globalisation is a force for good”, 77% of 18- to 24-year-olds do. The new nationalists are riding high on promises to close borders and restore societies to a past homogeneity. But if the next generation holds out, the future may once more be cosmopolitan.