ALEPPO, Syria/BEIRUT (Reuters) - An evacuation of rebel-held districts of Aleppo is back on track and expected to begin within hours, officials on both sides of the war said late on Wednesday, a retreat that would mark a major victory for Syrian President Bashar al-Assad and end years of fighting.
An initial deal that would have seen thousands of civilians and opposition fighters granted safe passage out of the city stalled on Wednesday and the planned exodus failed to materialise.
Iran, one of Assad's main backers, had imposed new conditions, saying it wanted the simultaneous evacuation of wounded from two villages besieged by rebels, according to rebel and U.N. sources.
But Abdul Salam Abdul Razak, a military spokesman for the Nour al-Din al Zinki rebel group, said late on Wednesday that a new agreement had been reached which included those villages in Idlib province. "Within the coming hours its implementation will begin," he told Reuters.
An official in the Jabha Shamiya rebel group said implementation would begin around 6 a.m. (0400 GMT) on Thursday.
An official in the pro-Damascus military alliance confirmed the truce deal was on, and said about 15,000 people would be evacuated from the majority Shi'ite villages, Foua and Kefraya, in return for the evacuation from Aleppo of "militants and their families and whoever wants to leave among civilians".
He said those leaving Aleppo would head for Idlib province to the west of the city.
The Jabha Shamiya official however denied that 15,000 people would leave the two villages and said only the wounded would be evacuated.
It was not immediately clear how the deal had been reached.
The original ceasefire was brokered by Russia, Assad's most powerful ally, and opposition backer Turkey on Tuesday. But the planned evacuation of rebel-held areas did not happen and instead shelling and gunfire erupted in the city on Wednesday, with Turkey accusing government forces of breaking the truce. Syrian state television said rebel shelling killed six people.
The U.N. High Commissioner for Human Rights, Zeid Ra'ad al Hussein, said the bombardment by Syrian government forces and their allies "most likely constitutes war crimes".
Turkish President Tayyip Erdogan and Russian leader Vladimir Putin agreed in a phone call earlier in the day to make a joint effort to start the process, Turkish presidential sources said.
Shortly before the new deal was announced, clashes raged in Aleppo.
Government forces made a new advance in Sukkari - one of just a handful of districts still held by rebels - and brought half of the neighbourhood under their control, the Observatory said. Rebels saying they launched an attack against government forces using suicide car bombs.
The Russian defence ministry said - before the report of the government forces' advance in Sukkari - that the rebels controlled an enclave of only 2.5 square km (1 square mile).
At dawn on Wednesday nobody had left under the initial evacuation plan, according to a Reuters witness waiting at the departure point, where 20 buses stood with engines running but showed no sign of moving into rebel districts.
People in eastern Aleppo had packed their bags and burned personal belongings, fearing looting by the Syrian army and its Iranian-backed militia allies.
Officials in the military alliance backing Assad could not be reached immediately for comment on why the evacuation had stalled.
U.N. war crimes investigators said the Syrian government bore the main responsibility for preventing any attacks and reprisals in eastern Aleppo and that it must hold to account any troops or allied forces committing violations.
In what appeared to be a separate development from the planned evacuation, the Russian defence ministry said 6,000 civilians and 366 fighters had left rebel-held districts over the past 24 hours.
A total of 15,000 people, including 4,000 rebel fighters, wanted to leave Aleppo, according to a media unit run by the Syrian government's ally Hezbollah.
The evacuation plan 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 from across the region.
Rebels have been supported by the United States, Turkey and Gulf monarchies, but the support they have enjoyed has fallen far short of the direct military backing given to Assad by Russia and Iran.
Russia's decision to deploy its air force to Syria 18 months ago turned the war in Assad's favour after rebel advances across western Syria. In addition to Aleppo, he has won back insurgent strongholds near Damascus this year.
The government and its allies have focused the bulk of their firepower on fighting rebels in western Syria rather than Islamic State, which this week managed to take back the ancient city of Palmyra, once again illustrating the challenge Assad faces reestablishing control over all Syria.
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.
The rout of rebels 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.
On Tuesday, the United Nations 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 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.
Reporting by Laila Bassam in Aleppo and Tom Perry, John Davison and Lisa Barrington in Beirut; Writing by Angus McDowall in Beirut; Editing by Giles Elgood and Pravin Char