Following her success in the Danish elections, Mette Frederiksen is set to return the Social Democrats to power. This contrasts starkly with such parties’ fate elsewhere in Europe: the long melancholy roar of an ebb tide. Mette’s explanation for that decline, pitched at working class voters, has been “you didn’t leave us; we left you”. She has won not by ditching core values but by returning to them. To grasp that, we need a larger picture than post-millennium Denmark.

Since 1945, for the first time in global history, some societies have achieved widely-shared material prosperity. Among them, a few have been able to do so while simultaneously enhancing other values intrinsic to being human, and which are better reflected in concepts such as “well-being”. Denmark is at the apex of this miracle: along with Norway, it has a reasonable claim to being the most successful society that has ever existed. It exemplifies the triumph of the political agenda we call social democracy.

The essence of social democracy was to recognise both the value and the grim limitations of market capitalism, building a belief system among citizens whereby the anxieties that it kept generating could be addressed. Political leaders communicated a sense of common purpose to achieve a forward-looking agenda, matched by inculcating a sense of mutual obligations to deliver it. People learnt that they had duties to each other: not just to their families, but to the entire society. Gradually, the society wove a dense web of reciprocal obligations: trapping people in it by the gentle pressure of self-respect and peer esteem. The economy grew, and the benefits were shared.

Reciprocity needs a domain of shared identity: I need to know to whom I owe obligations, and who I can call upon. Moreover, this domain needs to be common knowledge: we must all know that everyone understands the same things. Over time, habits form and reciprocity evolves from being transactional, in which people keep the score, to being a more generalised presumption of mutual regard, analogous, albeit in a more limited range of behaviour, to a good marriage.

Post-war social democracy did not build this shared identity, but fortuitously inherited it from rougher times. Shared identity had been forged through the common fate of international military struggles: it was shared nationality. Like everyone else, Danish social democracy took this shared identity for granted. Its achievement was to put it to good use.

But around the world, many societies continued along the more common paths of poverty and violence. As it became materially feasible for some people to move from these societies to Denmark, unsurprisingly some chose to do so. Insufficient thought was given as to how they and their children would be integrated into the prevailing new belief system of shared identity, forward-looking common purpose, and mutual obligations.

Within Danish society these ideas were so familiar that people came to assume that they were inherently obvious. Yet many migrants had come from countries with radically different beliefs. Legal citizenship did not automatically confer a new common identity: rather, it seemed to confer entitlements which could be claimed. Forward-looking common purpose was the antithesis of core beliefs in many poor societies, where priority was given to backward-looking grievances against rival groups. Obligations were to family and God, not to unrelated humans.

If a system of trust-based reciprocal obligations is stressed, it starts to crumble. From around 1980 all OECD countries faced not just immigration, but more potently, new economic forces of divergence. The metropolis began to boom, driven by the globalisation of markets, while provincial cities faced the risk of decline; the well-educated benefited from rising demand for their skills, driven by the greater complexity of the economy, while the value of manual skills started to fall. The metropolitan skilled found that they got more esteem from the identity conferred by their job than by their nationality and withdrew from shared identity with their less fortunate citizens. They justified their selfishness by transferring their regard to the immigrants coming to the metropolis: these, not their fellow-citizens, were the needy. Non-reciprocal concern for the entitlements of immigrants displaced reciprocal obligations to citizens just as it became time for those obligations to be met.

Like other social democratic parties, that in Denmark had always been based on an alliance between the provincial working class and the young metropolitan educated. But the change in the belief system of the metropolitans faced the party with a choice. The metropolitans held the advantage: unions were in decline, while they were on the rise. As they took over the party, the working class gradually drifted off, and disdainful metropolitans accused them of being “deplorable”, by which they meant “fascist”.

But the shared identity of post-war Denmark had not been a return to aggressive nationalism: it was there to define the boundaries of membership of the new system of shared obligations.

Depicting this as quasi-fascist was the theatrical conceit of those keen to ditch their obligations. The domain of reciprocity has to be national for the simple reason that the nation is the entity within which the tax revenues needed to meet those obligations can be raised. First and foremost, the key obligations are on skilled metropolitans to hand over more of the high productivity now generated by agglomeration, and which they wrongly attribute entirely to their own abilities.

Mette Frederiksen recognized the need for shared belonging. She is rebuilding common purpose around a forward-looking pragmatic agenda of addressing the new anxieties that global capitalism has thrust on the working class. But after years of neglect, working class voters no longer trusted the party. To re-establish credibility, she needed a “signalling action”: something that, had she been a metropolitan trying to bullshit them, she would not have done.

Across Europe, the most salient issue has become immigration: it has come to define the divide between the metropolitans and the working class. Hence, a sharp change of policy on immigration became that signal: the young metropolitans would have choked, rather than utter it. The signal re-established trust: the party won back working-class votes, while losing votes among the young metropolitans.

Meanwhile, some of Denmark’s other parties have veered into ugly and counter-productive anti-immigrant rhetoric. It is counterproductive because it makes yet more difficult the essential task of integrating all the immigrants and their children who are already citizens.

In tandem with her core focus on returning to the party’s roots in addressing the anxieties faced by working people, Frederiksen is paying serious attention to how integration can best be achieved. All citizens need to absorb the belief system of reciprocal obligations and mutual regard that underpins Denmark’s social miracle: that is the condition under which immigration from different cultures is sustainable. The acceptance of shared identity by immigrants does not preclude retaining some other identities. But it has to be sufficiently manifest to generate the common knowledge that they have embraced the identity, the common purpose, and the obligations that come with them.

Common beliefs spread through crucibles of social inclusion and interaction: pre-school, sports, music, work, clubs, all have this potential. Discussion of immigration policy can no longer be divorced from such practical processes of integration. Long ignored — dismissed by an exclusionary right, and rejected by a left obsessed by individual entitlements — it is now part of the suite of 21st-century Social Democrat policies. Frederiksen is pioneering the renewal of European social democracy: at its core is the rebuilding of shared identity, common purpose, and mutual obligations that eludes the metropolitans.

Paul Collier is professor of economics and public policy at the Blavatnik School of Government, Oxford University, and author of “The Future of Capitalism: Facing the New Anxieties” (Penguin)