We are at war. But the enemy is not who we think it is.

Sooner or maybe much later we will defeat IS, but this is not what is truly at stake. When that particular gang of criminals is finally worn down, another will spring up to take its place. If we haven’t learnt this over the last two decades, we never will.

At these moments of shock and sorrow, we ritually appeal to our values. This is all very well but it’s starting to ring hollow or at least a little weary. This is because that very appeal captures neither the scale nor the urgency of the task we face.

So what is truly at stake? In one word and an entire universe that lies behind it: freedom. Not the freedom to do this or the freedom to do that. But freedom in all its unique simplicity.

The real threat is not a terrorist group however much it detests human life, though we are certainly now prepared to witness more such attacks in our bars and restaurants and music venues. No, the most worrying threat now is our own loss of confidence in who we are. It’s our own identity that’s at stake.

Our loss of confidence, and with it a loss of direction, is not hard to explain – increasing numbers of our people have seen first-hand how our political system and economic model struggle to deliver stability, prosperity and fairness – and equally it’s not too late for us to win that confidence back. But it will take a war of sorts, and we need to find the courage to wage it.

Most urgently we need to appreciate, with fresh eyes, the wonderful society that we have patiently constructed over hundreds of years – at a terrible cost to ourselves and our neighbours, and with profound setbacks at regular intervals. It is not disrespectful to our poor or unemployed to say that Europe today lives in an age of spectacular prosperity, creativity and social peace, all more evenly shared than ever before. True, our rising inequality is both wrong and unsustainable but it lies within our power to reverse it if we wish. It often takes a keen eye and a sensitive soul from another land to see more clearly what we hold in our own hands.

If we ever doubt our good fortune, the ‘Martian test’ should set us right. Hovering high above our planet, free to chose any region in which to settle down with his family, the migrant from Mars in search of the good life will always chose Europe: his children, on balance, will have the best chance of growing up in a place that is not only safe, free and civilised, and not only cultured and creative, but also self-critical, self-deprecating and self-correcting. I suspect it will remain this way for some time to come.

If our loss of confidence is worrying then so too is our vulnerability to those who declare that our model – let’s call it liberal social-market democracy for the sake of argument – has in fact failed, and who promise happier times if we can only rediscover our purer pre-modern selves from a time when nation, family and organised religion delivered order and meaning. But their rallying call is not one of hope or even revival but one of despair; their wall-building a futile scheme to shut out a world they do not like. It is not that such voices speak from the ‘wrong side of history’ – history is without sides and cares little for the notion of progress – but rather that they offer no vision of what the world should be. They see only the past. They have given up the fight before it even starts.

If the ‘Martian test’ doesn’t convince you, then try this one. What vision of the future do Beijing and Moscow offer? Where are they headed, and what kind of society are they trying to build? What hope will they offer their people when the chips are really down?

With all its faults and failures and weaknesses and baggage full of historic guilt, Europe does offer a vision and has been living it for the last 60 years. It’s a vision that says we can overcome our past, build something better and find a way for people of different cultures, beliefs and languages to live together in peace. It’s a vision that says we can reconcile our thirst for freedom with our need for society. It’s a vision that’s messy, impure and bloody hard work but, against all the odds, it’s got off to a promising start.

As police investigate whether one of the attackers may have arrived last month on Greek shores holding a Syrian passport, people will demand tighter security, and all of these arguments will be hard to make. But make them we must. No one can explain away the barbarism that Paris has twice suffered in less than a year. Tonight and tomorrow, our most urgent tasks are safety, justice and grieving.

We are, indeed, at war. But this is not war against a people or an idea, for IS and other groups like it ultimately have no future. Even as they shock and disgust us in the here and now, the real battle is for our own freedom, and to win it we must find confidence in ourselves and the world we have built.