Syrian rebels have reached a ceasefire deal to evacuate from eastern Aleppo in an effective surrender, as Russia declared all military action had stopped and the Syrian government had assumed control of the former rebel enclave.
The dramatic developments, which appeared to restore the remainder of what was once Syria's largest city to President Bashar Assad's forces after months of heavy fighting and a crippling siege, followed reports of mass killings by government forces closing in on the final few blocks still held by the rebels.
Damascus confirmed the evacuation deal and the UN envoy for Syria, Staffan de Mistura, said that the safe withdrawal of people from the besieged area was now "imminent". He was at the Security Council where an emergency meeting for Aleppo was under way.
Russia's UN ambassador Vitaly Churkin took to the floor near the end of the session at the UN Security Council to announce fighting had ended.
"According to the latest information that we received... military actions in eastern Aleppo are over," Mr Churkin said. "The Syrian government has re-established control over eastern Aleppo."
Minutes earlier, he had announced that "all militants" and members of their families, as well as those wounded in the fighting, were being evacuated through "agreed corridors in directions that they have chosen voluntarily", including the rebel stronghold of Idlib province.
Retaking Aleppo, which has been split between rebel and government control since 2012, would be Mr Assad's biggest victory yet in the civil war. Aleppo, the country's former commercial powerhouse, has long been regarded as a major gateway between Turkey and Syria and the biggest prize in the conflict.
There were conflicting reports about the timing and route that the evacuation would take.
Syria's military media said the gunmen would be evacuated through the Ramouseh crossing and from there to rebel-controlled areas of northern Idlib province.
"Aleppo will be declared a secure and liberated city within the coming hours," it said on its Telegram channel.
Osama Abu Zayd, a Turkey-based legal adviser for an umbrella group of rebel factions known as the Free Syrian Army, said the ceasefire went into effect on Tuesday evening and that the first groups of rebel fighters would begin evacuating later on Tuesday.
Yasser al-Youssef, a rebel spokesman, confirmed the deal, and another spokesman, Ahmed Karali, said those leaving the city would head to rural areas in western Aleppo province then head north.
The agreement on Tuesday came after world leaders and aid agencies issued dramatic appeals on behalf of trapped residents, and the UN human rights office said that pro-government forces reportedly killed 82 civilians as they closed in on the last remaining rebel areas.
That and other reports of mass killings, which could not be independently confirmed, reinforced fears of atrocities in the final hours of the battle for the city.
UN secretary-general Ban Ki-moon told the emergency meeting that the UN supported negotiations among the parties, which were being facilitated by Russia and Turkey, and stood ready to help oversee an agreement.
He said he had received "credible reports" of civilians killed by intense bombing and summary executions by pro-government forces.
"Aleppo should represent the end of a quest for military victory," not the start of a new brutal campaign, he said.
Several residents and opposition activists said that government forces carried out summary killings of rebels in neighbourhoods captured on Monday, but the Syrian military denied the claim, saying such allegations were "a desperate attempt" to gain international sympathy.
None of the residents witnessed the alleged killings, and the reports came amid deepening chaos in the remaining rebel-held areas. Mohammed Abu Rajab, the administrator of the last remaining clinic in rebel-held parts of the city, said the dead and wounded were being left in the streets.
Bashar al-Ja'afari, Syria's ambassador to the United Nations, denied any mass executions or revenge attacks, but added it was Syria's "constitutional right" to go after "terrorists", a reference to all opposition fighters.
"Aleppo has been liberated from terrorists and those who toyed with terrorism," he said. "Aleppo has returned to the nation."
The UN children's agency said in a statement on Tuesday that it had received a report of more than 100 unaccompanied children trapped in a building under fire in eastern Aleppo. Unicef is concerned over reports of "extrajudicial killings of civilians, including children", said the agency's regional director, Geert Cappalaere.
The UN human rights office said it had received reports of pro-government forces killing at least 82 civilians in four neighbourhoods of the rapidly-shrinking rebel enclave, including 11 women and 13 children.
Spokesman Rupert Colville, speaking to reporters in Geneva, said the reports described pro-government forces entering homes and killing civilians "on the spot". He said the reports came in late on Monday and he did not know exactly when the killings took place.
A press release by the UN human rights office in Geneva said that multiple sources reported dozens of civilians were shot dead on Monday by government forces and allied militiamen in the Kallaseh and Bustan al-Qasr neighbourhoods of eastern Aleppo.
Rami Abdurrahman of the Britain-based Syrian Observatory for Human Rights said hundreds of bodies were still under the rubble.
A government win in Aleppo would significantly strengthen Mr Assad's hand but does not end the conflict - significant parts of Syria are still outside government control and huge swaths of the country are a devastated wasteland. More than a quarter of a million people have been killed since the conflict began in 2011 with peaceful protests against the Assad family's four-decade rule.