MOSCOW/BEIRUT/AMMAN (Reuters) - Rebel fighters began leaving the devastated Syrian city of Douma on Sunday in the first phase of a Russian-sponsored deal to evacuate thousands of rebels from the besieged enclave, state media said.

Slideshow ( 2 images )

A bus carrying dozens of fighters and their families left the city en route to opposition-held areas in northern Syria in an arrangement expected to take several days.

Almost simultaneously, a first batch of freed hostages held by the rebels in Douma arrived at an army-controlled crossing, state television showed. They received a euphoric welcome from hundreds of relatives waiting for them before being whisked away to a reception center.

Both developments were part of a Russian-sponsored deal sealed on Sunday that grants safe passage to thousands of rebels from their biggest remaining bastion near Damascus in return for rebel group Jaish al-Islam releasing hundreds of hostages and prisoners of war.

The agreement will be enforced by Russian military police, who will enter the city, opposition negotiators said.

The deal brought President Bashar al-Assad one of his biggest victories over the rebels since driving them from Aleppo in December 2016, though they remain entrenched in significant areas of northwestern and southwestern Syria.

It follows a seven-week government offensive to capture the towns and villages on the outskirts of the Syrian capital, in which more than 1,600 people have been killed, according rescuers and a monitoring group.

Medical aid groups reported that dozens of people were killed by poison gas in Douma on Saturday in an attack the rebels say was carried out by Damascus. The government has denied carrying out any such attack.

Under the agreement, Jaish al-Islam fighters will evacuate Douma and move to the northern city of Jarablus, near the border with Turkey, within 48 hours, state media quoted an official source as saying.

Russian news agency RIA, citing a security source, said Jaish al-Islam rebels will leave Douma in two batches in the coming hours.

Commercial crossing points into the besieged city are to be opened under the supervision of Russian military police, who will also enter the city, opposition negotiators said.

Russian military police have played a similar role in some Syrian towns and villages but this would be first such deal in a city the size of Douma.

Opposition negotiators said the deal would allow those fighters from Jaish al-Islam who do not wish to leave to make peace with the Syrian authorities without being pursued by the security forces.

The deal includes a six-month reprieve for those wanted for military conscription, negotiators told Reuters.