Two years ago, it seemed almost inevitable that Syrian President Bashar Assad would be toppled. Despite a fierce military crackdown, people were still taking to the streets in exuberant anti-government protests and rebels were pressing their fight deeper into the capital, even placing a bomb inside a high-level security meeting that killed top regime officials including Assad's brother-in-law.

Western leaders predicted Assad would fall in few months. Almost no one thinks that now. As he prepares for elections through which he is set to claim another seven-year mandate for himself, the 48-year-old leader appears to be on a continuously upward path in the three-year-old conflict.

A look at how Assad has managed to seize the momentum in the civil war:


The Iranian-backed Lebanese militant group joined the fight in Syria publicly and earnestly in mid-2013. With thousands of experienced guerrillas and experts, the group has been instrumental in helping Assad's overstretched forces gain ground around the capital, Damascus, and in strategic Syrian towns and villages in rugged mountains near the border with Lebanon.


Despite major defections early in the conflict, the Syrian military remains a potent force. There is no sign of significant fractures among Assad's lieutenants, and his inner circle has remained largely cohesive and united. Assad has also bolstered his military over the past year with the creation of paramilitary troops including the National Defense Force, a pro-government militia that draws heavily from Syria's minority communities and reportedly receives training from Iran.


The Syrian government has enjoyed unchecked use of its aircraft to pound opposition-held areas with missiles and crude explosives. The opposition has pleaded with the international community for more than two years to provide weapons with which to shoot down government warplanes. But the West has deep concerns that any lethal assistance could end up in the hands of extremists, and President Barack Obama has desperately sought to avoid embroiling the U.S. in another war after more than a decade of fighting in Afghanistan and Iraq.


In August 2013, Syria's key ally Russia stepped in to avert U.S. military strikes against regime targets by clinching a deal that would rid Syria of its chemical weapons stockpile following a toxic gas attack near Damascus that killed hundreds. Obama had said the use of chemical weapons was a "red line" that would trigger a harsh response. His waffling and change of course on the threatened airstrikes enraged Syrian opposition members and emboldened Assad.


The already divided umbrella group of rebel factions backed by the West, the Free Syrian Army, has seen its fortunes sink even further over the past year with the rise of militant groups and al-Qaida-inspired extremist factions. Since the beginning of the year, the two sides have turned their guns on each other in fighting that has killed thousands of people. The group's moderate leadership lost the confidence of the U.S. and its allies, particularly after Islamic extremists seized a weapons shipment last year, leading to the temporary suspension of U.S. aid shipments. Foreign fighters from every corner of the earth have flocked to Syria — a result of ever-increasing radicalization on all sides — dampening the West's support for the rebellion.


The exit of hundreds of rebels from the city of Homs this week gives Assad a geographic linchpin in central Syria from which to launch offensives on rebel-held territory in the north. But the cease-fire agreement also highlights a new Syrian government tactic. Such deals have seen weary rebels turn over their weapons to authorities in exchange for an easing of suffocating blockades that have prevented food, medicine and other staples from reaching rebel-held areas. That has enabled Assad's troops to be shifted to fighting fronts elsewhere in the country and allowed the government to present itself abroad as a responsible actor actively trying to broker peace at home.


Arab sponsors have increasingly clashed over the level and type of assistance they should offer the Syrian rebels. The cracks in what was once solid Arab support for the rebels are mostly rooted in long-simmering tensions between Saudi Arabia and Qatar. Saudi Arabia and its allies accuse Qatar of sending weapons to Islamic militant fighters that clash with more moderate rebel factions.


EDITOR'S NOTE — Zeina Karam is the AP's bureau chief in Beirut and has covered Syria since 1996.