The Syrian armed forces says it has returned the city of Aleppo to government control, ending a four-year rebel hold over parts of the city.

The last rebel fighters were said to have been evacuated from the city on Thursday, handing President Bashar al-Assad his biggest victory of the war.

The army said it had brought “security and safety” to Aleppo, ending four years of rebel resistance in parts of the northern Syrian city.

The last group of rebels and their families holed up in a small eastern enclave were evacuated on Thursday, under a deal that gives the army and its allies full control of the city after years of fighting, Syrian state television said.

At least 34,000 people, both civilians and fighters, have been evacuated from eastern Aleppo in a week-long operation hampered by severe winter weather, the latest UN figures show. But the United Nations estimates that thousands more remain.

“The process for evacuation was traumatic, with crowding, and vulnerable people waiting for hours and exposed to sub-zero temperatures,” UN spokesman Farhan Haq told reporters in New York.

The last evacuees left a tiny pocket that was all that remained of a rebel sector that covered nearly half of Aleppo before being besieged in the summer and hit by intense air strikes that reduced swathes of it to rubble. As the months of bombardment wore on, rescue and health services collapsed.

Aleppo before the Syrian Civil War Show all 12 1 /12 Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War A man crosses a street in Aleppo, December 12, 2009 Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War A vendor sits inside an antique shop in al-Jdeideh neighbourhood, in the Old City of Aleppo, December 12, 2009 Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War A view shows part of Aleppo's historic citadel, overlooking Aleppo city, Syria Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War A view shows part of Aleppo's historic citadel, Syria Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War Visitors walk inside Aleppo's Umayyad mosque, Syria Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War People walk inside the Khan al-Shounah market, in the Old City of Aleppo, Syria Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War A man walks past shops in al-Jdeideh neighbourhood, in the Old City of Aleppo, Syria Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War People walk along an alley in al-Jdeideh neighbourhood, in the Old City of Aleppo, Syria Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War Visitors tour Aleppo's historic citadel, Syria December 11, 2009 Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War A general view shows the Old City of Aleppo as seen from Aleppo's historic citadel, Syria December 11, 2009 Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War People walk near Aleppo's Bab al-Faraj Clock Tower, Syria October 6, 2010 Reuters Aleppo before the Syrian Civil War Aleppo before the Syrian Civil War A man stands inside Aleppo's historic citadel, overlooking Aleppo city, Syria December 11, 2009 Reuters

The retaking of the city came as the UN special envoy for Syria warned on Thursday that cessation of hostilities across the country is vital to avoid another battle like the bloody fight for Aleppo,

Steffan de Mistura said thousands of people evacuated from rebel-held areas of Aleppo after a crushing government offensive could suffer a similar fate in their new refuge outside the city.

“Many of them have gone to Idlib, which could be in theory the next Aleppo,” Mr de Mistura warned from Geneva.

The Syrian President has declared that the war is far from over and said his armed forces would march on other rebel-held areas.

Evacuees from Aleppo had expressed concerns about being taken to Idlib and a senior European diplomat said earlier this month that this would suit Russia, the Assad regime’s main military backer, as it would put “all their rotten eggs in one basket”.

Drone footage of fleeing civilians reveals scale of devastation in Aleppo

The last group of civilians and rebels holed up in a small enclave of Aleppo was expected to leave in the next 24 hours, with the Syrian army and its allies seizing all of the city, delivering the biggest prize yet of the nearly six-year war to Mr Assad.

In comments after meeting a senior Iranian delegation, Mr Assad said his battlefield successes were a “basic step on the road to ending terrorism in the whole of Syria and creating the right circumstances for a solution to end the war”.

Russia’s air force conducted hundreds of raids that pulverised rebel-held parts of Aleppo, while Iran-backed militias, led by the Lebanese group Hezbollah, poured thousands of fighters into the city to fight the rebels.

The foreign and defence ministers of Russia, Iran and Turkey met in Moscow on Tuesday and agreed to help broker a new peace deal for Syria.

Russia is not discussing the future of Mr Assad in its talks with Iran and Turkey, deputy foreign minister Sergei Ryabkov said.

Mr de Mistura said that a cessation of hostilities across Syria was a “priority” and having “regional players like Turkey, Russia and Iran talk to each other is a good thing”.

Quoting Russian President Vladimir Putin, Mr de Mistura said talks expected to be held in Kazakhstan were “not considered a competition, it is complementary and a support to the preparation of the UN role [in Syrian peace talks] on 8 February”.