BEIRUT, Lebanon — In the final days the outgunned Syrian rebels, deprived of reinforcements, ammunition and sleep, were surviving on olives and canned beans. They were hiding in the concrete shells of destroyed houses and underground tunnels near the besieged rebel stronghold of Qusayr, unable to help their trapped colleagues and civilians dying of treatable wounds, as Syrian government forces and their Hezbollah allies from Lebanon assaulted the town by land and air.

By Wednesday morning, it was time to flee for the rebel fighters in Qusayr, who had managed to repel the Syrian Army for months but could not withstand the additional attacks from Hezbollah, the Lebanese Shiite Muslim organization whose leader, Hassan Nasrallah, has made common cause with President Bashar al-Assad of Syria in the two-year-old civil war.

In triumphal tones, the Syrian news media announced that Qusayr had been seized, as rebels said they had withdrawn from most of the city but vowed to fight on. Syrian state media broadcast photographs of soldiers raising flags over wrecked buildings as the rebels fled, and the Syrian military was calling the victory a turning point.

But Mr. Assad was victorious not because his military alone had defeated the rebels. Rather, he appeared to owe the victory to Hezbollah, which provided crucial infantry power in recent weeks. Hezbollah’s role and the vengeful reactions of its critics have further intensified sectarian divisions in Syria and beyond its borders, creating new risks for both Mr. Assad and Mr. Nasrallah even in their moment of victory.