Syrian army soldiers stands on the ruins of the Temple of Bel in the historic city of Palmyra, in Homs Governorate, Syria April 1 REUTERS/Omar Sanadiki

The Islamic State (IS) is supposed to be on its way to defeat. IS is under assault in Mosul and the operation to evict it from Raqqa began a month ago. Just this morning, Turkish-backed rebel forces in Syria have reportedly pierced IS's defences in al-Bab, IS's most important city outside of its twin capitals. But on Sunday, after a four-day offensive, IS seized Palmyra. How to explain this?

The first thing to note is that the idea of Palmyra's fall as a lightning strike that suddenly overwhelmed the city's defences, when thousands of IS jihadists expelled from Mosul poured in, is false. IS has been shaping this offensive for many months, and the appearance of a sudden collapse –as in Mosul in June 2014 – is this long process coming into public view.

The reality is that IS seized an opportunity in Palmyra.

A little background: When IS took over the city the first time in May 2015, near simultaneous with the capture of Ramadi, it encountered little resistance.

The regime continued losing ground over the summer of 2015, provoking a direct Russian intervention in September 2015 that was explained, quite falsely, as an effort to destroy IS. Moscow trained its firepower on the mainstream armed opposition, systematically targeting the parts of the opposition supported by the West, which actually opened space for IS to expand. In July 2016, Russia even attacked US-supported forces that only fight IS.

Rather than counterterrorism, the actual Russian intention was to secure Assad militarily and then extinguish all workable alternatives, thereby rehabilitating Assad politically. To disguise this fact and rewrite the narrative of the intervention as one of anti-extremism, Russia's ruler, Vladimir Putin, sought to end the major offensive phase of the intervention in March 2016 by pushing IS out of Palmyra.

Within three weeks that month, the pro-regime coalition – the tattered military and paramilitary structures of Bashar al-Assad's regime, Russian soldiers and Serbian mercenaries, Iran's Islamic Revolutionary Guards and regular forces, an international brigade of Shia jihadists under Tehran's control, and the air power of both Assad and Russia – was able to pose among the ancient ruins, a symbolic ratification of the Russian claim to be manning the front line for civilisation against terrorist hordes.

Tens of thousands of rebels would remain in the field after Aleppo's fall, only now more vulnerable to al-Qaeda's lures since they fought in the trenches with the revolutionary forces, while the West tried to reach a military pact with Moscow to target Assad's foes

Because the primary objective was political and time-sensitive, most of IS's force in Palmyra was allowed to leave in what was in effect a coordinated withdrawal. Manipulating jihadists was nothing new for regimes trained by the KGB. Victory declared, the Russians even had a concert.

Over the summer, the pro-regime coalition ceased offensive operations against IS to secure Palmyra, and diverted resources to an assault on the areas of Aleppo City held by the nationalist rebels. Unlike last time, the pro-regime forces​ in Palmyra​ ​ resisted IS fiercely, but were unable to hold ​IS back. With only minimal losses from the March offensive and operating in the kind of virtually ungoverned desert area in which IS thrives, IS took advantage of the regime's defensive posture to infiltrate the area, co-opting or eliminating those who stood in its way.

A pro-regime source told The Daily Beast that the National Defense Force (NDF), a sectarian militia trained, equipped, and largely commanded by Iran, that now outstrips the regular army, had been left in place. "The NDF had over 800 men posted around the strategic Shaar gas field and the other areas, in addition to around 250 regular soldiers," said the source. "When ISIS attacked ... they retreated and left most of the heavy weapons without a fight. In the panic, over 100 were killed or are still missing. Word is that a senior NDF commander who was stationed around Shaar was bribed by ISIS."

The spectacular corruption of the local warlords that make up "the Assad regime," whose fragmentation is fully the equal of the notoriously fractious rebellion, has been a feature of Syria's war from the very beginning. An astonishing amount of rebel weaponry, for example, was simply bought from regime brigade commanders at their bases.

The are at least two lessons to be taken from the fall of Palmyra, one about the pro-Assad coalition and one about the Islamic State.

The lesson on the pro-Assad coalition is not to overestimate it and not to imagine that its "successes" are either lasting or in the West's interests. There is currently an undercurrent, with varying degrees of enthusiasm, to a lot of the commentary on the apparently-imminent fall of Aleppo City that it will at least bring the war closer to an end. Strategically, yes, the rebellion would be defeated by Aleppo's fall. But, putting aside the bad taste of celebrating the expansion of the area in which the pro-Assad forces can commit crimes against humanity, the idea that such expansion brings any form of peace or stability closer is wrong twice.

Tens of thousands of rebels would remain in the field after Aleppo's fall, only now more vulnerable to al-Qaeda's lures since they fought in the trenches with the revolutionary forces, while the West tried to reach a military pact with Moscow to target Assad's foes. The transition from efforts at insurgent governance to guerrilla warfare would bolster al-Qaeda's fortunes even further by creating greater dependency among rebels in this new, more savage phase of Syria's war that will compound the loss of life and the displacement, worsening the knock-on effects for European politics.

The pro-regime coalition will not be able to suppress this violence. It has admitted that chronic manpower shortage will make Aleppo difficult to hold after the aerial massacres and death squad activity clears it, and it is a pure fantasy to believe the pro-Assad forces can then be mobilised to move into eastern Syria, to Raqqa and Deir Ezzor, to defeat IS.

Which leads to the lesson on IS. The organisation has managed to launch serious counterattacks and diversionary raids in Mosul, giving an indication of how difficult it will be to sweep IS from these final cities it holds, where it is determined to make a stand.

And that is just the beginning. IS is waging a long-term revolutionary war: it can take military setbacks provided it gains a political victory from them, and the flaws in the Coalition's war-making are providing this. Physically speaking, IS has its fall-back option planned in the deserts to wait out this defeat – a time of "tribulation, which in reality is a gift [from god]," as IS's new spokesman put it.

It worked last time and the political situation this time is even more fortuitous for IS. Without local, legitimate forces to govern the spaces from which IS is displaced, the end of the caliphate will merely be resetting the cycle.