There’s a lot of truth in the old joke that nostalgia ain’t what it used to be. The word itself has a sense that has been largely lost. Its original 17th-century coinage was as a kind of mental illness, a homesickness suffered by soldiers on foreign campaigns. Only lately did it morph into a warm, indulgent enjoyment of how things used to be.

Now nostalgia seems to be changing once again, turning into a different kind of pathology, one that infects not individuals but society. Bertelsmann Stiftung, a German foundation, has conducted a poll in Europe’s five largest nations and found that two thirds of Europeans believe that the world used to be a better place. These nostalgic Europeans are generally more rightwing and much more critical of immigration. The report claims that their discontent is being exploited by populists to “fuel dissatisfaction with the political system and distrust of mainstream political elites”.

Nostalgia should not become the property of reactionary xenophobes. Ironically, it’s a feeling with more potential than has yet been realised.

The best kind of nostalgia combines warm feelings towards what once was with sadness that it is, and can be, no more. To focus only on the bitter or the sweet in this is unbalanced. To only lament is to fail to appreciate the goodness that once was; to only enjoy is to deny the irretrievability of the past.

The kind of nostalgia that Bertelsmann Stiftung deplores fails to maintain this delicate tension. Populist politics tells people that their sadness is not necessary because the present can be as the past once was. The steel towns can be brought back to life, the streets can be largely free of those with different accents or skin colours, pensions can continue to be paid as they once were, even as the proportion of people above working age soars. The past is not irretrievable, it is simply being kept out of reach by rootless, mercenary elites who found it got in their way.

Remainers are not immune to this kind of nostalgia. Those who think all we need is a second referendum and we’ll get back all we have lost fail to appreciate the fundamental changes that made the Brexit vote possible. An EU with a future cannot be an EU unchanged from its past. Nor can the kind of domestic politics that created disdain for “Westminster elites” remain business as usual without stirring rebellion.

‘Those who think all we need is a second referendum and we’ll get back all we have lost fail to appreciate the fundamental changes that made the Brexit vote possible.’ Photograph: RMV/REX/Shutterstock

A better kind of reflective nostalgia, however, can enable a lament for the past to help us build a different future. This requires us to distinguish what cannot be revived from what lies beaten but breathing.

For example, those of us who are already beginning to feel nostalgic when we pass though the passport lane for EU citizens need to remember that the institution has always been deeply flawed. What made it still precious was its role in bringing the historically bellicose nations of Europe closer together. Why not feel nostalgic if the emotions that stirs in turn stir us to try to get hearts and minds back focused on that invaluable goal of continental cooperation?

People who have fought for a better future always have to convince others that how things are is not how they always must be. One of the most powerful ways of proving this point is to show that things were different, and can be so again. Take the problem of our divided society and our increasingly polarised politics. There can be no return to the postwar consensus or a two-party system based on neat class lines. Indeed, good riddance to both, which are well past their best-by dates. But the civility of political debate and the understanding that whoever forms a government governs for all are not beyond salvation. We can be nostalgic for those without wanting to turn back the clock.

That’s why it’s wrong to dismiss nostalgia as pointless, insisting that the present is better in every way or that only the future matters. The future is as ephemeral as the past, which it soon becomes with frightening speed anyway. A person only capable of looking forward is as defective as one who can only look back. The idea that we should do neither but simply live in the moment is naive: human relationships and solidarity depend on us having shared pasts and futures.

We live in time, where past, present and future all have a significance. When nostalgia is tempered by an acceptance that change is unavoidable, it can help us both to appreciate what we once had and see more clearly what could still be. Used wisely, nostalgia doesn’t trap us in the past but helps point us to a better tomorrow.

• Julian Baggini, a British philosopher and author, runs the website Microphilosophy