ALEPPO, Syria/BEIRUT - Syrian rebels prepared to withdraw from Aleppo on Wednesday after a ceasefire agreement that ended years of fighting in the city and gave President Bashar al-Assad his biggest victory yet after more than five years of war.

The agreement was a result of talks between Russia, Assad’s main ally, and Turkey, a leading backer of the rebels, a Turkish government official said. The guns fell silent late on Tuesday in Aleppo. A Reuters reporter in the city said no blasts had been heard after days of near constant bombardment.

It was the culmination of two weeks of rapid advances by the Syrian army and its allies that drove insurgents back into an ever-smaller pocket of the city under intense air strikes and artillery fire.

By taking full control of Aleppo, Assad has proved the power of his military coalition, aided by Russia’s air force and an array of Shi’ite militias backed by Iran.

“Over the last hour we have received information that the military activities in east Aleppo have stopped, it has stopped,” said Russia’s U.N. envoy Vitaly Churkin late on Tuesday at a heated meeting of the U.N. Security Council. “The Syrian government has established control over east Aleppo.”

Rebels groups have been supported by the United States, Turkey and Gulf monarchies, but the insurgent ranks also include jihadist militants who are not backed by Western countries.

However, Assad is far from winning Syria’s complex civil war even after reclaiming the major prize of Aleppo. The rebels fight on from strongholds elsewhere in the country, including in the northwest and in areas south of Damascus.

Omar Sanadiki / Reuters Smoke and debris fill the air amid the siege of Aleppo.

ALEPPO VICTORY PIVOTAL

Assad has said victory in Aleppo would be a turning point in the war but that his army had to march on other rebel enclaves.

Islamic State group, while on the back foot in northern Syrian territories, suffering from the loss of many of its leaders through air strikes and under attack in Iraq, this week managed to retake the desert city of Palmyra from Syria’s army.

Russia regards the fall of Aleppo as a major victory against terrorists, as it and Assad characterize all the rebel groups, both Islamist and nationalist, fighting to oust him.

But at the United Nations, the United States said the violence in the city, besieged and bombarded for months, represented “modern evil”.

The once-flourishing economic center with its renowned ancient sites has been pulverized during the war which has killed hundreds of thousands of people, created the world’s worst refugee crisis and allowed for the rise of Islamic State.

As the battle for Aleppo unfolded, global concern has risen over the plight of the 250,000 civilians who were thought to remain in its rebel-held eastern sector before the sudden army advance began at the end of November.

Tens of thousands of them fled to parts of the city held by the government or by a Kurdish militia, and tens of thousands more retreated further into the rebel enclave as it rapidly shrank under the army’s lightning advance.

The rout of rebels from their shrinking territory in Aleppo sparked a mass flight of terrified civilians and insurgents in bitter weather, a crisis the United Nations said was a “complete meltdown of humanity”. There were food and water shortages in rebel areas with all hospitals closed.

Abdalrhman Ismail / Reuters A woman who was injured during the siege of Aleppo.

“SHOT IN THEIR HOMES”

The United Nations earlier on Tuesday voiced deep concern about reports it had received of Syrian soldiers and allied Iraqi fighters summarily shooting dead 82 people in recaptured east Aleppo districts. It accused them of “slaughter”.

“The reports we had are of people being shot in the street trying to flee and shot in their homes,” said Rupert Colville, a U.N. spokesman. “There could be many more.”

The Syrian army has denied carrying out killings or torture among those captured, and Russia said on Tuesday rebels had “kept over 100,000 people in east Aleppo as human shields”.

Fear stalked the city’s streets. Some survivors trudged in the rain past dead bodies to the government-held west or the few districts still in rebel hands. Others stayed in their homes and awaited the Syrian army’s arrival.

For all of them, fear of arrest, conscription or summary execution added to the daily terror of bombardment.

“People are saying the troops have lists of families of fighters and are asking them if they had sons with the terrorists. (They are) then either left or shot and left to die,” said Abu Malek al-Shamali in Seif al-Dawla, one of the last rebel-held districts.

Terrible conditions were described by city residents.

Abu Malek al-Shamali, a resident in the rebel area, said dead bodies lay in the streets. “There are many corpses in Fardous and Bustan al-Qasr with no one to bury them,” he said.

(Reporting By Laila Bassam in Aleppo and Tom Perry, John Davison and Lisa Barrington in Beirut; Writing by Angus McDowall in Beirut, editing by Peter Millership)