BEIRUT (Reuters) - Syrian rebels left one besieged enclave on Friday and agreed to abandon another, leaving only the city of Douma still in insurgent hands in eastern Ghouta after a month-long army assault to drive them from the stronghold near Damascus.

It brings President Bashar al-Assad to the cusp of his biggest victory over the rebels since driving them from Aleppo in December 2016, though they remain entrenched in areas of northwestern and southwestern Syria.

The offensive to capture the towns and villages on the outskirts of the capital, which began on Feb. 18 with a massive bombardment, has brought 90 percent of eastern Ghouta back under government control. More than 1,600 people have been killed, a war monitor said.

Syrian army soldiers fired tracer bullets into the night air in celebration on Friday as the last groups of rebels in the town of Harasta boarded buses for opposition territory in the northwest along with family members.

They had agreed to surrender the town in return for safe passage out and a pardon for civilians who chose to remain there as the government took back control.

The government’s assault, backed by Russia, was one of the fiercest of the seven-year-old war and was carried out in defiance of international pleas to halt and honour a ceasefire.

At the start of the offensive, the United Nations estimated 400,000 people were trapped inside the besieged area without access to food or medicine.

Slideshow ( 4 images )

Syrian state television broadcast the departure of rebels and their families. From behind a half-drawn curtain, a woman in a headscarf could be seen gazing out through a spiderweb of bullet holes and cracks in the window of a bus as it prepared to carry her to exile.

A Reuters witness near where the buses were gathering said some men had disembarked to pray while women and children walked nearby.

Meanwhile, rebels in a second pocket around the towns of Arbin, Jobar, Zamalka and Ein Terma said they had also agreed to leave for the northwest with their families and any other civilians who did not wish to come back under Assad’s rule.

People who wished to stay on would not face prosecution, said Wael Alwan, spokesman for the Failaq al-Rahman group there, adding that the group would also release captured government soldiers.

About 7,000 people would depart in the deal starting on Saturday morning, including fighters carrying light weapons, state TV reported.

But bombs still fell on Friday on the besieged city of Douma, from which thousands of people have fled into government territory in recent days.

Slideshow ( 4 images )

Once insurgents complete their agreed withdrawals from the other areas, it will stand as the last battered and besieged rebel zone in eastern Ghouta, itself the opposition’s last major bastion near the capital.

ASSAULT

The Syrian army’s assault to recapture the area has been marked by tactics the army has used to crush resistance since Russia joined the war on Assad’s side in 2015 - lay siege to an area, bombard it, launch a ground assault and finally offer the rebels and their families safe passage to the northwest.

After helping turn the tide of the war in Assad’s favour with air power and military support, Russia has increasingly cast itself as a peace-broker. Russian representatives have played a role in negotiating local ceasefires and evacuations.

Assad and his allies say their offensive in eastern Ghouta is necessary to end the rule of Islamist militants over the area’s people, and to stop them shelling government areas.

Rebel rocket fire has killed scores of people during the army offensive on eastern Ghouta, state television has reported including in a strike that hit a market place on Tuesday.

A source in the Syrian Arab Red Crescent agency said four of its members, as well as other civilians, were injured on Friday by an explosion in Harasta. The war monitor, the Syrian Observatory for Human Rights, said the blast was caused by rebels detonating their arsenal before departing.

By the time the last convoy departed Harasta on Friday evening, state media reported that scores of buses had left, carrying thousands of people including well over a thousand fighters. Shortly afterwards, the army retook the town, the state media said.

State television broadcast footage of what it said was about 3,400 people leaving Douma on foot on Friday morning, carrying small children and belongings. Thousands of civilians have made the same journey over the past week, making their way to reception centres in government-held territory.

They were leaving behind them a blast-wrecked landscape of smashed concrete and twisted metal, where for weeks people have cowered in basements from the unrelenting bombardment.

Already besieged for years, people in eastern Ghouta have suffered acute shortages of food and medicine, and during the weeks-long battle they were often unable to leave their homes even to bury the dead.

The United Nations estimates more than 50,000 people have fled besieged areas of eastern Ghouta in the past two weeks.