(CNN)In the summer of 2015, President Bashar al-Assad was in trouble. His army -- fighting on multiple fronts amid desertion and exhaustion -- was losing ground. Islamist rebel groups were threatening to cut key routes connecting regime strongholds. And then an Iranian general went to Moscow, and the tide of Syria's conflict began to change, gradually but remorselessly, in the regime's favor.
Assad may win Syria's war, but he will preside over a broken country
That general was Qasem Soleimani, commander of the Iranian Revolutionary Guards' Quds Force.
He had seen at first hand that the war was going badly, despite the involvement of pro-Iranian militia and the Lebanese Hezbollah fighting on the side of the regime.
Soleimani's meetings in Moscow would rescue Assad but condemn Syria to destruction on an ever-greater scale. For the next two years, Russia and Iran underpinned a scorched-earth campaign that broke the back of the resistance but laid waste to Syria.
By the late summer of 2015, Assad's forces controlled less than a quarter of Syria. The Alawite heartland around Latakia was threatened; so was the regime-held part of Aleppo, Syria's largest city. Assad announced an amnesty for army deserters and the regime abandoned its strategy of an army "in all corners" of Syria to focus on Damascus and a corridor leading to the coast.
Russia was also anxious that Assad would be overthrown and that Syria, long an ally of Moscow, would become a failed state, another Yemen. But the Kremlin calculated that a combination of Russian air power and Iranian militia on the ground could reverse the course of the war. And by showing decisive will in Syria, Russia could contrast its own determination to back an ally with US ambivalence toward the moderate rebel groups it had promised to help.
At the UN General Assembly in September 2015, Russian President Vladimir Putin said western intervention in the Middle East had been a disaster. "Instead of democracy and progress, there is now violence, poverty, social disasters and total disregard for human rights," he said.
As he spoke, the first Russian combat aircraft were arriving at a hastily upgraded base on the Syrian coast.
For Putin, a Syrian expedition would show off Russian military prowess, safeguard Moscow's toehold in the Mediterranean and outmaneuver the Obama administration. For Soleimani and the Quds force, already active in neighboring Iraq, a bolder presence in Syria would bring closer the Islamic Republic's dream of an arc of influence from Tehran to Beirut.
The Kremlin said its air force would destroy "terrorist" groups in Syria. In fact, the targets were frequently moderate rebel groups supported by the United States and the Gulf countries. In late 2015, Russian planes were often flying well over 100 sorties a day. The United States and human rights groups accused Moscow of indiscriminate bombing of civilian infrastructure, especially hospitals.
A joint operations room was formed and several thousand Hezbollah militia, as well as Iranian Quds fighters, joined the Syrian army to begin to roll back rebel gains in the north and northwest. Possessing few weapons that could take out planes or tanks, the rebels began to lose ground.
The Obama administration -- concerned that more advanced weapons would fall into extremist hands -- had a cumbersome vetting process for groups it supported. Its train-and-equip program was enough to keep a few rebel groups alive but far too little to change the military balance. And its exclusive focus on airstrikes against ISIS -- but not the Assad regime -- infuriated Syrian rebel groups, moderate and otherwise.
The regime also benefited from divisions among rebel groups, and fighting between them, especially ISIS' desire to obliterate all other factions. Methodically, with the Geneva peace process stymied and successive ceasefires failing, regime forces and their allies embarked on a new strategy. ISIS was left alone, and so were the Kurds, who were building a large autonomous region in the north. The regime focused on the spine of Syria -- north from Damascus to Homs and Hama; while intense aerial bombardment of the northwestern province of Idlib kept rebel groups off balance.
By mid-2016, the Syrian army, fortified by Russian-supplied hardware and supported by Hezbollah and Iranian fighters, was closing in on its greatest prize: recapturing eastern Aleppo. A siege of rebel-held areas was tightened; there was the daily terror of barrel-bombs; and once again rebel groups turned on each other. As a photographer in Aleppo told CNN, "There's not enough food stored for more than a month. If they force a siege for one month, people will die."
After the last access to the outside world was closed off, a Russian-mediated evacuation decanted thousands of rebels and their families to Idlib, a tactic that might be described as clear-and-dump and has also been applied elsewhere. In the space of a few months, the population of Idlib doubled to more than two million.
Since Aleppo, the regime has been able to pick off the last pockets of resistance, such as Eastern Ghouta outside Damascus. Assad and the Russians finally turned their attention to ISIS-held areas such as Deir Ezzor, not least because they were oil-rich. And Putin coaxed Turkish President Recep Tayyip Erdogan into being part of a plan to create what were called "deconfliction zones" -- frequently areas put on ice until the regime could muster the resources to attack them.
In January last year, the chief of the general staff of the Russian Armed Forces, Valery Gerasimov, said Russian aviation had carried out 19,160 combat missions and 71,000 strikes since the beginning of its involvement in Syria. The Defense Ministry said that over 48,000 service members had ″gained combat experience" in the country.
The campaign has often seemed like a scorched-earth policy, but it has succeeded in corralling what is left of the revolt, in Idlib and a few other scattered pockets (if you exclude the Kurds and the Syrian Democratic Forces in the far north of Syria). It has also succeeded in radicalizing the uprising, with militant Islamist factions in the ascendancy. The political opposition to Assad, fuming in exile, has virtually no armed wing inside Syria.
Bashar al-Assad has won in the sense that there is no viable alternative to his rule that enjoys broad international support. He has lost in the sense that he now presides over a broken country, whose reconstruction could cost anything from $100 billion upwards. International donors and investors are highly unlikely to venture anywhere near Syria until a credible political settlement is worked out. As Syrian journalist Jihad Yazigi put it, "Saudi Arabia is not going to put money in a country that is controlled by Iran." And Russia doesn't have the money.
While Syria's rebel groups are down, they are not yet out. They have years of combat experience, and several have a jihadist outlook that scorns surrender or compromise. Even as their control of territory shrinks, a return to guerrilla warfare beckons.
The regime now controls well over half of Syria but almost all of the border with Turkey is still beyond its reach. Assad is propped up by troops and militia from four countries; those of a fifth (Turkey) are cutting a swath across parts of northern Syria. Above all, seven years of conflict have produced a toxic legacy of extremism, distrust and abject poverty.