Islamic State militants agreed to give up their last pocket in Damascus on Friday, state media reported, as the government seeks to retake the entire Syrian capital and its surrounding areas for the first time since 2011.

The capitulation followed a week of escalations by pro-government forces against the IS-held Hajar al-Aswad neighbourhood and Yarmouk Palestinian camp in Damascus.

The military bombed the two areas and blanketed them with artillery fire in a crescendo of violence captured by the state-affiliated Central Military Media outlet.

The UN’s refugee agency warned that the spiralling violence was a threat to 12,000 Palestinian refugees still there – Palestinians who came to Syria since 1948, and their descendants.

Militants were given the option to stay and reconcile with the government or leave on buses to IS-held territory in the eastern Syrian desert, the SANA state news agency said. It did not say when the relocations would begin.

The Britain-based Syrian Observatory for Human Rights monitoring group reported “relative calm” in the two neighbourhoods after the announcement.

In 2012, Western-backed rebels pushed the army out of Yarmouk in what was said to be a response to a crackdown by state security services against anti-government protests.

The military, including pro-government Palestinian factions, responded by putting the camp under siege, eventually cutting off food and water by 2014, and bombing and shelling it continuously.

Residents trickled out to neighbouring areas, and the camp’s population dwindled from an estimated 200,000 people to a few thousand today, not including the IS militants, who took over the camp following a battle with rebels in 2015.

On Thursday, the Damascus-based Palestinian official Khaled Abdelmajid said the government was giving hardliners two days to leave Yarmouk and Hajar al-Aswad, leaving the government with control of the two neighbourhoods.

That initial deal appears to have collapsed. It was not immediately clear why.