If he gets his way, Donald Trump will announce at some point in the coming week that the Islamic State terrorist group has been defeated and its hate-filled caliphate in Syria and Iraq destroyed. This will be the second time the US president has declared victory over the jihadists.

When Trump first made the claim, in December, he was sharply contradicted by his own intelligence chiefs and by British ministers. Now he is being more cautious. But his eagerness to hog the credit for a limited success he had precious little to do with will probably get the better of him, sooner rather than later.

It is certainly accurate to say that the territory occupied by Isis when it swept through Iraq and Syria in 2014, equivalent in size to the whole of Britain, has dwindled to almost nothing. What remains of the caliphate declared by its leader, Abu Bakr al-Baghdadi, amounts to one or two besieged villages in south-eastern Syria.

Reports from the area spoke of Isis fighters and their families surrendering to a western-backed Kurdish and Arab militia known as the Syrian Democratic Forces. Isis in-fighting is said to have led to an attempt to assassinate Baghdadi, who is now on the run. This is welcome news.

The so-called Islamic State … is transforming into an asymmetrical warfare force. And this, of course, is a threat. Angela Merkel

But it’s not the end of the story. Isis is a pernicious, bigoted idea as well as a vicious fighting force and this idea, rooted in extreme religious fundamentalism – of all-out, violent opposition to “apostate regimes” in the Muslim world and to the western powers – is far from vanquished.

It’s a point made forcefully by Germany’s chancellor, Angela Merkel, in her now familiar role of Trump reality checker. “The so-called Islamic State has been luckily driven out of its territory but this unfortunately doesn’t mean [it] has disappeared,” Merkel said. “It is transforming into an asymmetrical warfare force. And this, of course, is a threat.”

What Merkel meant was that Isis and what it stands for remain capable of influencing and attracting terror recruits around the world, notwithstanding its loss of a central command base. Isis affiliates remain involved in insurgencies from Nigeria and Somalia to Afghanistan and the Philippines. It has many followers in Europe, too. By some estimates, Isis adherents have conducted or inspired more than 140 terrorist attacks in 29 countries other than Iraq and Syria since 2014, killing at least 2,000 people.

Isis was originally an Iraqi offshoot of al-Qaida, whose attacks on New York and Washington in 2001 sparked what became known as the global “war on terror”. The phrase was first used by George W Bush shortly after 9/11 and came to encompass a wide range of US military, special forces, counter-intelligence and covert assassination and rendition operations. As well as morally insupportable, much of this activity was illegal under American and international law.

The legacy of the war on terror is a dreadful one, with an estimated half-a-million lives lost. Yet perhaps the most damning indictment arises from the way in which, far from eradicating Islamist-inspired terror as Bush pledged, it encouraged its spread, creating lasting divisions and distrust between Muslims and the west.

Barack Obama declared a formal end to the war on terror in 2013. But it continues to be waged, in different theatres, with varying intensity, amid mounting confusion about strategy and aims. Trump says US troops must leave Syria, while Congress says they must stay. He also wants out of Afghanistan, but offers no clue as to what happens if, as seems possible, the Taliban and assorted jihadists sweep into Kabul.

At the same time, Trump misses no opportunity to vilify Iran as the “world’s leading state sponsor of terrorism”, a phrase repeated to applause in last week’s State of the Union address. Is Tehran where this endlessly misconceived, never-ending tragedy leads next?