Eight and a half months into the coalition-backed campaign to liberate Mosul, Iraq’s second city looks like it is finally on the brink of freedom. After launching the last phase of the battle in mid-June, the Iraqi security forces slowly but surely penetrated the Old City, one of the final ISIS redoubts in Mosul. And, on Thursday, just after recapturing the Nuri Mosque—at which ISIS leader Abu Bakr al-Baghdadi accepted his role as “caliph” in June 2014, and which ISIS demolished one week ago—the Iraqi Prime Minister Haider al-Abadi declared the “end of the Daesh [ISIS] state of falsehood.”

While this is indisputably good news, we must rein in our optimism. The truth is, ISIS has been planning for defeat in Mosul for months, if not years. Losing the city has long been part of its global plan. And even though the loss of its self-declared Iraqi capital will be a genuine blow to the group’s territorial pretensions, ISIS is not going to evaporate just because it has fallen.

Since October 2016, when the campaign to retake Mosul was first launched, ISIS has been putting up an immensely stiff resistance: thousands of its fighters have been killed by coalition forces, and hundreds more blown up in suicide operations. But no matter how fiercely it fought, the group was never realistically going to repel the onslaught. The few thousand fighters that ISIS had holed up in the city faced about ten times as many members of a reconstituted and determined Iraqi security forces that was backed by U.S. air power.

What, then, were the strategic objectives of ISIS’s doomed resistance these last few months? While its leaders persistently proclaimed that victory was just around the corner, and while the rank-and-file were probably fighting under the pretense that they might actually win, something more abstract seems to have been driving the battle. At its heart has been a compulsive obsession, not so much with defense as with narrative—the caliphate has been doing all it can to make sure it could be seen to be putting up a fight. In that sense, much of what has happened since late 2016 can be seen as an exercise in propaganda—expensive, wasteful propaganda, but propaganda all the same.

ISIS has almost certainly been planning for this moment since 2014. By seizing as much territory as it did back then, its leaders were violating one of the key principles of non-state on state irregular warfare: Act scarce, and never present an obvious target. Given their proven insurgent pedigree, they will almost certainly have been aware of this. Nevertheless, by taking over Mosul—a city of some 2 million people—they laid the foundations for the apparent catastrophe that their organization now faces.

But what if this “catastrophe” is what ISIS wants? The group has been counter-intuitive in the past, so why not now?

If statehood was indeed the Islamic State’s aim, it has resoundingly failed. However, if it really hoped to establish a lasting, viable administration, it would not have raped, murdered, and terrorized its way across the Middle East and North Africa in the way it did, let alone systematically provoked the international community into forming a coalition to destroy it.

What if, more than anything else including territory, the group just wants permanence, to be the ideological hegemon of global jihadism? In this pursuit, the realization of ideological aspirations is far more important than the permanent administration of any piece of land, even if it comes at great material cost.

Viewed through this lens, ISIS’s most counter-intuitive acts become intuitive, if not ingenious, parts of a narrative-led strategy, one that prioritizes conceptual longevity over anything else.

For example, while the beheadings and war crimes that provoked the international intervention in Iraq and Syria may have materially hurt it, they also allowed it to wrest control of the global jihadist mantle, and claim to be singlehandedly taking the fight to the “Crusader enemy.” So too did its capture of Mosul and caliphate declaration in June 2014, even though neither made insurgent “sense.”

The fact is that, although ISIS’s audacious ultraviolence ultimately set the scene for its material undoing, it also meant that it could work towards creating the world it wanted to inhabit—a polarized, turbulent place that accommodated the jihadist ideology uncannily well.

For ISIS, this is what success looks like and, as short-lived as it was, the group has already gotten a good deal of what it wanted from the Mosul experiment. Seizing and administering the city for over a thousand days was more than enough for the group to make its mark as caliphate, and will be sufficient for it to boast in years to come of the jihadist utopia that once was. It alone will be enough to keep the true believers in its ranks in tow, even once it has lost everything else.

Long after the city has fallen back into the hands of the Iraqi government, it will continue to be a prop for ISIS, although an altogether different one. No longer will it be a paragon of jihadist governance. Instead, it will be a prototype for insurgency. ISIS will continue to propagandize through Mosul and, provided it can use it as a baton of instability with which to hit the Iraqi government (and the rest of the world too), the self-proclaimed caliphate is not going anywhere anytime soon.