P OLITICIANS HAVE always exploited the past. But just now, rich countries and emerging economies are experiencing an outbreak of nostalgia. Right and left, democracies and autocracies, all are harking back to the glories of yesteryear. Even as President Donald Trump vows to “Make America great again”, President Xi Jinping is using his “Chinese dream” to banish a century of humiliation and return China to its golden age. Mexico’s new president, Andrés Manuel López Obrador, has a mission to withstand global capitalism and restore his country’s economic sovereignty. Jaroslaw Kaczynski, the most powerful politician in Poland, wants to purge the last traces of Soviet communism to bring about a renaissance of old-fashioned Polish values.

This orgy of reminiscence has different causes in different countries. In emerging markets past glories are often a foretaste of future triumphs. China, which has enjoyed 40 years of transformative growth, senses that it is on the threshold of something great. Under Narendra Modi, India has been celebrating its growing geopolitical heft with a Hindu-nationalist revival.

In the rich world, by contrast, nostalgia usually stems from what Sophia Gaston, of the Henry Jackson Society, calls “an omnipresent, menacing feeling of decline”. Almost two-thirds of Britons think that life used to be better. A similar share of the French do not feel at home in the present. This year’s UN World Happiness Report found that Americans are becoming less content. Large majorities in rich and developing countries believe that robots and automation will increase inequality and harm employment. A poll of 28 countries in 2017 found that over half of respondents expected their living conditions to stagnate or worsen. Only 15% of Japanese think their children will be richer than their parents.

Vaults full of research attest to how emerging-market optimism is more soundly based than rich-country pessimism. People around the world are living longer, healthier lives; fewer fall victim to war and famine; as education spreads, discrimination and prejudice are waning. Similarly, the summers were rarely as idyllic or the nation as glorious as sentiment would have it.

But to reject pessimism and nostalgia as simply inaccurate misses the point. They are powerful forces that are shaping politics. To harness them, you must first understand them.

Nostalgia serves optimists and pessimists alike as an anchor in a world being transformed. New technologies, including artificial intelligence, threaten to disrupt entire industries and to alter the relationship between the state and the citizen. After two centuries power is shifting from the West back to China. The planet is ageing faster than at any time in history. Its climate is changing. It is ever more racially and culturally mixed.

At such moments, people are drawn to nostalgia as a source of reassurance and self-esteem. Many Brexiteers hope that leaving the European Union means they will once again belong to a dynamic “global Britain”. Catalans evoke an idealised past in pursuit of a distinctive identity. Alarmed by corruption and recession, Brazilians have elected a president who harks back to the certainties of a military dictatorship they rid themselves of three decades ago. When Mr Trump boosts coal and steel, men who feared that they had been marginalised in dirty, dying industries suddenly feel as if they are worth something again.

In the rich world, nostalgia also offers a way to rebel against someone else’s idea of progress—to “take back control”. The far-right Alternative for Germany has its strongest support in the former East, where voters regret their loss of community and security. In France the gilets jaunes smash shop windows on the Champs-Elysées because they cannot make ends meet. They reject the trade-off offered by their president, Emmanuel Macron, between national prosperity and individual economic security.

This makes nostalgia dangerous. Protesters do not necessarily expect to put back the clock—they may just be seeking to slow it down. And yet such sclerosis may only aggravate the sense of decline. In addition, the self-esteem that nostalgists crave often seems to feed xenophobia. India’s Hindu-nationalist revival has seen an increase in reported hate crimes towards Muslims. In the West people on the right remember a whiter past, with fewer cultures, even as the hard left condemns the machinations of global business. It is no accident that there has been a resurgence of anti-Semitism, not least in Britain’s Labour Party under the backward-looking Jeremy Corbyn.

Because of the taint of xenophobia, progressives are quick to treat all nostalgia as prejudice, leading them to dismiss the fears of whole sections of society. That sweeping judgment is one more reason why populists have been able to exploit nostalgia so successfully.

They are having it too easy. Nostalgia can be harnessed for good. At the start of the 20th century, Europe and America were nostalgic, too, buffeted by a similar confluence of technological, geopolitical and cultural change. Then a period of conflict and social upheaval led to universal suffrage and education for all. Today’s politicians can learn from that time. They must avoid war, obviously, by preserving and enhancing the institutions that enable countries to work together. But they should also find bold ways to deal with insecurity and alienation. That will involve the state working harder for the citizen by making education available throughout people’s lives, by overhauling taxation, devolving power to cities and regions, averting climate catastrophe, and wise management of immigration.

If the past is a foreign country, let me emigrate

The nostalgists are on to something. When one way of running the world seems to be exhausted, but the next has yet to come into being, the past holds important lessons. When nothing seems to make sense, history becomes the supreme discipline. Knowing who you are and where you came from matters.

The best way to harness the past demolishes prejudice and opens horizons. A proper sense of history helps you grasp that progress depends on facing up to hard choices. Sometimes it can inspire, too. Fifty years ago Apollo 8 took off from Cape Canaveral in Florida. On December 24th it captured a photograph of Earth, a half-shrouded blue-white planet, seemingly united.