HOMS, Syria — On the ragged fringes of the Old City, aid workers, clerics and government troops stood vigil, awaiting a U.N. convoy evacuating women, children and the aged from the besieged ancient quarter of a town known to many as ground zero in the Syrian civil war.

But the buses disgorged a very different class of passenger: scores of young men, haggard and sallow-faced, blankets draped over their shoulders and fear evident in their eyes. They shuffled under the hostile gaze of Syrian troops and intelligence officers toward a makeshift processing center in a rundown banquet hall.

The men, who turned themselves in last month, were remnants of Homs’ rebel defenders, once the spearhead of the insurgency, now bedraggled and half-starved. They were placing their fate in the hands of their most bitter foe, the forces of President Bashar Assad.

“What do you think they will do with us?” one after another of the dispirited men asked in hushed tones.

As the Syrian conflict enters its fourth year, one thing is clear: The U.S.-backed rebels are losing the war. Assad’s army, once dismissed as inadequately equipped, ill-prepared for guerrilla fighting and of suspect loyalty, is chalking up victory after victory.

Unlikely as it once seemed and as unpalatable as it may be to U.S. policymakers and their allies, Assad could end up the sole Middle East leader to remain in power after coming under threat from the so-called Arab Spring revolts.

Assad has survived in large part because of disarray in the rebel ranks, including the rise of Islamist militants hostile to Syria’s tradition of tolerant Islam; a steady flow of military and financial aid from Russia and Iran; and a revived Syrian military bolstered by local militiamen and Hezbollah fighters from Lebanon. The latter have proved a major asset, routing rebels close to the porous Lebanese border and providing a disciplined, well-trained force to take pressure off the overstretched military.

Assad has also benefited from a sense of war-weariness that has prompted many insurgents to lay down their arms and civilians to turn against the struggle. Barring an unexpected development, such as Assad’s death or direct foreign intervention, it’s hard to fathom how the opposition can turn things around.

Last summer, U.S. warplanes seemed poised to strike Damascus, the capital and Assad’s seat of power, a threat averted at the eleventh hour, when he agreed to relinquish his chemical-weapons stockpiles. Now Assad is confident enough that he is widely expected to run for a third seven-year term this summer, in an election condemned by the opposition as a fraud.

Great swaths of Syria, especially to the north and east, remain out of government hands. For Assad, retaking such far-flung territories will be problematic as long as arms and fighters flow in from the Turkish and Iraqi frontiers.

Yet much of this land is under the sway of al-Qaida-affiliated groups or other extremist Sunni Islamist factions disavowed by the United States and its allies. In such areas, rebel brigades are battling one another, a war within a civil war between Western-backed rebel factions and radical Islamists.

In essence, Syria has been transformed into a many-sided geopolitical board game, with Iran, Russia and Shiite Hezbollah fighters arrayed against the U.S., Israel, Saudi Arabia and Sunni Islamist fighters from around the world, each pursuing their own strategic interests as death and destruction mounts.

“Syria has become a playground for international and ideological Islamist conflict,” said Jamil Salou, a pro-opposition media activist based in Turkey.

Though Syria’s majority Sunni population has been the backbone of the rebellion against Assad — a member of the minority Alawite sect — many secular Sunnis, and middle-class Syrians of all sects, appear aghast at the prospect of an Islamist takeover.

“We’re not for Assad, but we all prefer this government over the Islamists, that’s for sure,” said Bassel, a young Sunni banker encountered in the upscale Abu Rummaneh district of Damascus, which is often a target of indiscriminate rebel shelling. “How could we live with them? That would be the end of Syria.”

Essential to the government’s resurgence has been its well-armed military. Long trained for a traditional land war with Israel, it is becoming increasingly adept at fighting an insurgency.

The government’s strategy has been to focus on protecting Damascus and the major corridor north to Homs and west to the Mediterranean coast, a pro-Assad stronghold. The once-perilous route has become more secure in recent months, an indication that the approach has worked.

An extensive series of checkpoints in Damascus has cut down on car bombings. Troops are no longer ferried through dangerous areas in unarmored buses. Recent ambushes of opposition formations suggest that intelligence-gathering may also be improving.

Meanwhile, the opposition, which still proclaims that victory is within reach, has no answer to the government’s air power, which has been especially devastating in the northern city of Aleppo, once home to more than 2 million.

Syrian military commanders say the heavy shelling that precedes entry by the infantry is a time-honored war strategy.

“We had to hit them hard with force — then move in,” a Syrian officer who gave his name as Col. Samir, said as he ushered journalists around the debris-strewn Khalidiya neighborhood adjacent to Homs’ Old City.

Opposition forces regarded as moderate by the U.S. have all but collapsed in several key regions because of a lack of coherence and any semblance of a central command, as well as an absence of heavy weaponry to counteract the air attacks and, perhaps most significantly, the rise of the Sunni Islamists.

The fear that these radicals could commandeer powerful armaments has made the U.S. and its allies reluctant to provide the rebels with sophisticated weapons such as shoulder-fired anti-aircraft missiles, which could also be used against civilian airliners.

The actions of the Islamists have alienated even many who have long loathed Assad’s crushing of political dissent.

The war has left more than 100,000 dead, sent more than 2 million Syrians fleeing their country and forced 6 million from their homes.

Long-contested areas close to Damascus, like the Yarmouk district, are essentially surrounded, with civilian residents subject to siege by both sides. Other rebellious suburbs of the capital have acceded to “truces,” which many see as de facto capitulations.

According to the government, thousands of former rebels have returned to the army or pro-government militias as part of the truce process. Rebels still retain strongholds outside Damascus, especially in the sprawling Ghouta region to the northeast. But many of these areas are in the hands of militant Islamists.

South of the capital, the United States and its allies are reported to be pushing more moderate rebels to carry out a “southern strategy” offensive, but whether anything will come of the effort remains unclear.

At what was once the heart of the Syrian uprising, in western Homs province, the opposition is on the run.

Adjacent to the city of Homs’ Old City is the Zahra district, an ultra-loyalist enclave that is home to large numbers of Alawites. Residents there threw up cinder-block walls, some as high as 30 feet, to provide protection from rebel snipers. Many were unhappy that hundreds of ex-rebels from the Old City would apparently face no charges under what the government terms a “reconciliation” process.

“Everyone here has lost a loved one or neighbor or friend,” said Mohammed, 32, a government worker. “I personally have lost 20 family members. That is no joke. How can one get over such a loss?”

Someday, the Syrian war will wind down and the pulverized sections of Homs and other cities and towns will probably be rebuilt. Restoring trust among Syria’s patchwork of religious and ethnic groups is another matter. That may take many generations.