BEIRUT — As Syria’s war enters what could be its last and most dangerous stretch, the Syrian government and its allies will have to contend for the first time with foreign troops in the quest to bring the rest of the country back under President Bashar al-Assad’s control.
The government’s recent defeat of rebels in the southwest of Syria has put Assad unassailably in control of a majority of the country, his hold on power now facing no discernible military or diplomatic threat.
But at least one-third of Syria remains outside government control, and those areas are occupied both by Turkish and American troops.
Turkey has deployed soldiers in the northwest, in parts of the rebel-held province of Aleppo and in Idlib, which Assad has identified as the next target of an offensive. About 2000 US Special Forces hold sway in the northeast, in support of their Kurdish allies fighting against the Islamic State.
Iran has meanwhile entrenched its forces and allied militias alongside loyalist Syrian troops across government-held territory, stirring deep concern for Israel.
Even as the war enters its final stages, the risk that it could ignite a wider conflict has not passed, analysts say.
It will fall to Russia to steer Syria through the pitfalls ahead, as the only outside power to enjoy good relations with all the countries that have a stake in the Syrian war, including Israel and Iran.
After intervening in the conflict in 2015 to save the Assad regime, Moscow has largely succeeded in balancing the competing interests of the various players, tamping down fears that the conflict could ignite a regional conflagration.
But Russia’s capacity to manage these competing concerns is limited and will be tested by the coming battles, said Riad Khawija, who heads the Dubai-based Inegma defense consultancy.
‘‘Russia is not as much in control as it likes to appear,’’ he said, citing the apparent failure of recent Russian diplomacy aimed at addressing Israel’s concerns about Iran’s presence.
‘‘Iran has invested so much in Syria, it’s not going to leave now, if ever,’’ he said. ‘‘So with Iran refusing to get its forces out of Syria and the Israel insistence that it leave, eventually there is going to be a clash.’’
Russia’s priorities for now are to stabilize the areas already recaptured by Syrian forces, bring back at least some of the 6 million refugees who fled the country, rebuild the Syrian army, kick-start reconstruction and secure international recognition for Russian efforts through a peace settlement, said Kamal Alam of the London-based Royal United Services Institute, who was recently in Damascus.
‘‘The Russians are aware that the areas that have been retaken are ticking time bombs and they want to make sure there are no large-scale revenge attacks,’’ he said. ‘‘The war isn’t quite over but now is the time to stabilize the country and in reality the hard work has been done.’’
The immediate priority for the Syrian government, however, is to regain the remaining territories outside its control, starting with the province of Idlib, according to recent statements by Assad and his allies.
Syrian troops that have been freed up after pacifying the south have been redeploying to the north in anticipation of an offensive in Idlib.
At the same time, Turkey has been reinforcing its observation posts in the province, which were established under an agreement with the Russians.
Turkish President Recep Tayyip Erdogan has called Idlib a ‘‘red line’’ and vowed to defend any attempt to reclaim the province from Turkey’s sphere of influence, raising the risk of a showdown between his country, which is a NATO ally, and Syria, Russia, and Iran.
A fight for Idlib could be more devastating than any of the previous battles. As Syrian forces recaptured other pockets of territory, the battles were settled by evacuating rebels to Idlib, which now contains up to 70,000 fighters.
That is the biggest concentration of opposition fighters yet assembled. A significant number of those are extremists belonging to Al Qaeda affiliates in Syria. There are also an estimated 3 million civilians in Idlib, many of whom took refuge there after fleeing fighting elsewhere in the country. An assault on Idlib could trigger Syria’s largest humanitarian crisis yet and a prompt a new exodus of refugees to Turkey and perhaps to Europe, analysts say.
Russian officials have made it clear they would prefer a negotiated solution for Idlib, along the lines of the one that ended the recent battle for southwestern Syria — a relatively bloodless outcome compared with bloodbaths elsewhere.
In the southwest, most of the rebel groups agreed to reconcile with the Syrian government in return for local control, and some joined loyalist troops to fight for a last pocket controlled by the Islamic State.
Russia’s special envoy for Syria, Alexander Lavrentiev, told the Russian news agency Tass that Russia hopes to use southwestern Syria as a model for Idlib.