BEIRUT - From his base in Damascus, Bashar al-Assad can contemplate a broad sweep of Syria clawed back from rebels who once threatened to drive him out. The capital which they targeted is now plastered with posters inviting Syrians to reelect him president.
Powerful foreign allies have helped Assad hold or retake a chain of cities which form the north-south backbone of the country, keep his grip on the Mediterranean coast to the west and restore control over the Lebanese border.
The culmination of that slow, grinding military turnaround came last week with the final withdrawal of rebel fighters from Homs city, a month before the presidential election in which Assad faces no serious challenge.
His foes dismiss the June 3 vote as a farce, saying the huge areas still beyond his command make a credible vote impossible, but the fact that authorities can consider a notionally countrywide ballot reveals their growing confidence.
One of the two candidates officially approved to run against Assad said the overwhelming majority of Syrians would be able to vote, downplaying the fighting that still kills around 200 people a day and the almost three million who have fled.
"In the middle of the country the situation is perfect for election. On the coast the situation is very good. In the southern part of Syria the situation is getting better," said Hassan al-Nouri, a US-educated former minister of state.
The military respite has come at a cost. Assad's foreign Shi'ite supporters have often taken the lead in battle, leaving his own forces to play a peripheral role against rebels who are themselves increasingly directed by outside Sunni powers.
Whoever pulls the strings, though, the long term momentum is clear.
Rebels have fought Assad's forces in Homs city since the early days of the uprising in 2011. Until a year ago they held territory along the main highway from Homs to Damascus and controlled the capital's eastern and southern suburbs.
Now that they have pulled out of Syria's third biggest city, battered by years of bombardment, siege and retreat, Assad's hold over the heart of the country is tighter than it has ever been since protests against his rule turned to armed insurgency.
On the fringes, rebels still pose a deadly challenge, holding parts of Aleppo and Deraa at the northern and southern tips of that backbone of Syrian cities.
Most of the northern border with Turkey is also in rebel hands, as are swathes of northern Syria, the eastern oilfields and farmlands, and southern areas close to Jordanian border and the Golan Heights.
Assad's enemies make much of the fact that the territory under his control may only account for a third of the country, but it forms an increasingly coherent core, linked by secure road connections, where a semblances of normality exists and the great majority of the population now lives.
By contrast the rebel-held land - riven with internecine fighting and battered by waves of Assad's aerial bombardment - offers neither security to the population nor a military platform to strike against his strongholds.