Islamic State militants have withdrawn from their last stronghold in Syria following a government offensive that has effectively left the extremist group’s fighters dispersed in villages and small towns in the desert.

The Syrian military declared the town liberated after intense battles that killed a large number of militants, including leaders. The military said they are still chasing other IS militants in different directions in the desert.

“The liberation of Boukamal is of great importance because it is a declaration of the fall of this group’s project in the region generally and the collapse of its supporters’ illusions to divide it, control large parts of the Syria-Iraq borders and secure supply routes between the two countries,” said Army spokesman Ali Mayhoub in a televised statement.

Syrian pro-government media said Syrian troops had clashed with remnants of IS militants in the town after they entered it late Wednesday. Yesterday, they reported the town clear of IS fighters.

The Britain-based Syrian Observatory for Human Rights said government forces and allied troops, including Iraqi forces who linked from across the border, are combing through Boukamal after IS militants withdrew.

It said: "The Syrian Observatory for Human Rights monitored that the regime forces backed by armed militiamen loyal to them of Syrian, Arab and Asian nationalities and the Iraqi Popular Mobilisation Forces managed to advance in Al-Bokamal city on the border with Iraq, and managed to impose their full control over the city, which was the largest stronghold of ISIS in Syria, and this control came after the remaining members of the organisation withdrew from the city, to its controlled areas remaining in the eastern countryside of Deir Ezzor, after a corridor was opened for them by the gunmen loyal to the regime forces, while reliable sources confirmed to the Syrian Observatory that the regime forces started to sweep the city of mines and explosive devices which were planted by the organisation earlier in the city."

An Iraqi spokesman for the Popular Mobilisation Forces said last week that his forces, part of the Iraqi security forces, will head north to protect the borders and secure the road from Iran to Lebanon.

The whereabouts of IS leader Abu Bakr al-Baghdadi is unknown.

Baghdadi, who declared a self-styled "caliphate" on IS-held territories in Syria and Iraq in 2014, apparently released an audio recording in September.

In the public statement, the first issued by him in almost a year, he ordered his fighters not to "retreat, run away, negotiate or surrender".

"The road towards achieving victory is patience and steadfastness in the face of hardship," he said. "We are remaining."

He praised the fight put up by Islamic State in Mosul, which fell to Iraqi forces after nine months of fighting.

Following the collapse of Mosul, Lieutenant General Stephen Townsend, commander of the US-led coalition in Iraq and Syria, cautioned the battle against the militants is not over.

However, with the collapse of IS in Boukamal, Islamic State militants have no major territorial control in Syria and Iraq and are believed to have dispersed in the desert west and east of the Euphrates River.

Just last week, as the Syrian army declared victory in Deir el-Zour, General Mayhoub said they were in the midst of the "last phase" in the military's campaign towards the complete annihilation of IS in Syria.

US officials estimated that there were between 2,500 and 3,500 IS militants around Boukamal and that leading members of the group were also believed to have taken refuge in the town. The group has a small presence near the capital Damascus.

IS has suffered consecutive defeats at the hands of separate but simultaneous offensives in Iraq and Syria by the Russian-backed Syrian forces and allied militias as well as US-backed Iraqi and Syrian fighters.

Despite its fall, the group’s media apparatus has remained active and its fighters are likely to keep up their insurgency from desert areas.

The swift fall of Boukamal in eastern Deir el-Zour province was accelerated after Iraqi forces seized Qaim, the town across the border last weekend, also controlling a strategic crossing between the two countries.

A senior Iraqi official said there was an agreement on Tuesday to send Iraqi paramilitaries to Syria to take part in the Boukamal operation, adding that the Syrians were to supply them with weapons and gear.

Boukamal is the last urban centre for the militants in both Iraq and Syria where Syrian troops - backed by Russia and Iranian-supported militias - and US-backed Syrian Democratic Forces are vying for control of the strategic border town.

Washington is wary of increasing Iran influence in the area and has backed the SDF in their bid to uproot IS from the borders with Iraq. The proximity of forces in the area has raised concerns about potential clashes between them as they approach Boukamal from opposite sides of the Euphrates River, and now from across the border with Iraq.

It was not clear if the government seizure of the town means the end of the race for control of territory previously held by IS.

So far the Kurdish-led SDF have focused on the area east of the Euphrates, seizing a number of oil and gas fields and securing large swathes of areas along the border with Iraq, as well as the newly liberated Raqqa city.