Relief agencies evacuated 500 wounded people from four besieged Syrian towns, in what has been described as the largest such operation so far in the five-year conflict.
Half were brought out from towns blockaded by pro-government forces, and half from towns blocked off by rebels.
A UN chief in Syria said he had been told the operation had been successfully carried out.
Meanwhile, peace talks that started in Geneva a week ago are in difficulty.
It is not clear whether a partial truce that has lasted seven weeks so far will hold.
Opposition representatives walked out of the talks this week, blaming government violations of the ceasefire.
Activists said government air strikes on Tuesday had killed 40 people in rebel-held areas.
Some 250 wounded people were evacuated from Zabadani and Madaya, near Damascus and the Lebanese border. Both these towns are blockaded by pro-government forces.
Meanwhile, a further 250 wounded people were brought out of Foua and Kefraya in the north-west of the country near Aleppo. Both of these towns are predominantly loyal to the government and are blockaded by rebels.
They were all brought to a staging area in the rebel-held area of Qalaat al-Madiq where they were exchanged and taken on for treatment.
Jan Egeland, chairman of a UN humanitarian task force in Syria, said the operation had faced many problems and delays but added, "as far as I know it is now successfully completed."
"They have now come to their destinations," he told the BBC. "Of course their destinations are either in government-controlled areas or in opposition-controlled areas."
Mr Egeland hailed "the largest evacuation ever from the besieged areas of Syria" as a "breakthrough".
He said it had been carried out mostly by the Syrian Red Crescent in cooperation with the UN and the International Committee of the Red Cross.
"These have been very difficult negotiations going for a long time," he went on, saying both sides had insisted an equal number of wounded, sick and relatives left from the two areas.
Some of those who were evacuated are in need of life-saving medical attention, the UN has said.
Almost half a million people live under siege in Syria, the UN estimates. This is the first major evacuation since December 2015.
Meanwhile, the Syrian regime's chief representative in Geneva, Bashar al-Jaafari, insisted that the talks there would continue.
He told reporters that "no faction" had a "veto power".
Mr Jaafari said: "By leaving, [the opposition representatives] may be taking away a major obstacle and that will allow us to reach a solution."