Donald Trump has threatened to release hundreds of Isis fighters captured in Syria unless Britain and other allies put them on trial.

The American president urged European nations including the UK, France and Germany to “take back” more than 800 jihadi militants as the US prepares to withdraw troops from the Middle East.

“The alternative is not a good one in that we will be forced to release them,” he tweeted. “The US does not want to watch as these Isis fighters permeate Europe, which is where they are expected to go.

“We do so much, and spend so much – Time for others to step up and do the job that they are so capable of doing.”

His warning came with US-backed forces poised to capture the last, tiny enclave of Isis’s once-sprawling proclaimed caliphate.

Timeline of the Isis caliphate Show all 19 1 /19 Timeline of the Isis caliphate Timeline of the Isis caliphate ISIS began as a group by the merging of extremist organisations ISI and al-Nusra in 2013. Following clashes, Syrian rebels captured the ISIS headquarters in Aleppo in January 2014 (pictured) AFP/Getty Timeline of the Isis caliphate Abu Bakr Al-Baghdadi declared the creation of a caliphate in Mosul on 27 June 2014 Timeline of the Isis caliphate Isis conquered the Kurdish towns of Sinjar and Zumar in August 2014, forcing thousands of civilians to flee their homes. Pictured are a group of Yazidi Kurds who have fled Rex Timeline of the Isis caliphate On September 2 2014 Isis released a video depicting the beheading of US journalist Steven Sotloff. On September 13 they released another video showing the execution of British aid worker David Haines Timeline of the Isis caliphate The US launched its first airstrikes against Isis in Syria on 23 September 2014. Here Lt Gen William C Mayville Jnr speaks about the bombing campaign in the wake of the first strikes Getty Timeline of the Isis caliphate Isis militants sit atop a hill planted with their flag in the Syrian town of Kobani on 6 October 2014. They had been advancing on Kobani since mid-September and by now was in control of the city’s entrance and exit points AFP/Getty Timeline of the Isis caliphate Residents of the border village of Alizar keep guard day and night as they wait in fear of mortar fire from Isis who have occupied the nearby city of Kobani Getty Timeline of the Isis caliphate Smoke rises following a US airstrike on Kobani, 28 October 2014 AFP/Getty Timeline of the Isis caliphate YPG fighters raise a flag as they reclaim Kobani on 26 January 2015 VOA Timeline of the Isis caliphate Isis seized the ancient Syrian city of Palmyra on 20 May 2015. This image show the city from above days after its capture by Isis Getty Timeline of the Isis caliphate Kurdish forces are stationed on a hill above the town of Sinjar as smoke rises following US airstrikes on 12 November 2015 AFP/Getty Timeline of the Isis caliphate Kurdish forces enter Sinjar after seizing it from Isis control on 13 November 2015 AFP/Getty Timeline of the Isis caliphate Iraqi government forces make the victory sign as they retake the city of Fallujah from ISIS on 26 June 2016 Getty Timeline of the Isis caliphate Iraqi forces battle with Isis for the city of Mosul on 30 June 2017 AFP/Getty Timeline of the Isis caliphate Members of the Iraqi federal police raise flags in Mosul on 8 July 2017. On the following day, Iraqi prime minister Haider Al Abadi declares victory over Isis in Mosul Getty Timeline of the Isis caliphate Members of Syrian Democratic Forces celebrate in Al-Naim square after taking back the city of Raqqa from Isis. US-backed Syrian forces declare victory over Isis in Raqqa on 20 October 2017 after a four-month long campaign Getty Timeline of the Isis caliphate Female fighters of the Syrian Democratic Forces celebrate in Al-Naim Square after taking back the city of Raqqa from Isis. US-backed Syrian forces declare victory over Isis in Raqqa on 20 October 2017 after a four-month long campaign AFP/Getty Timeline of the Isis caliphate Trucks full of women and children arrive from the last Isis-held areas in Deir ez-Zor, Syria in January 2019 They were among the last civilians to be living in the ISIS caliphate, by this time reduced to just two small villages in Syria’s Deir ez-Zor Richard Hall/The Independent Timeline of the Isis caliphate Zikia Ibrahim, 28, with her two-year-old son and 8-month-old daughter, after fleeing the Isis caliphate, on Saturday 26 January 2019 Richard Hall/The Independent

The Kurdish-led Syrian Democratic Forces (SDF) said on Saturday they had cornered the jihadi group in a 700-square-metre encampment in the village of Baghouz on the eastern banks of the Euphrates river.

“The caliphate is ready to fall,” said Mr Trump, who added the US would be “pulling back” after the last pocket of Isis territory is seized.

In December the president shocked allies and his own advisers by ordering the full withdrawal of 2,000 US troops from Syria.

“We have defeated Isis in Syria, my only reason for being there during the Trump presidency,” he declared at the time.

His position is at odds with his own US military chiefs, who warn the recapture of Isis territory does not mean the group has been vanquished.

SDF battle commander Jiya Furat said his forces would move onto “chasing down sleeper cells and remnants spread out across the region” after seizing control of Baghouz.

The swift withdrawal of US troops from Syria could also have a potentially destabilising effect in the north and east of the country, where Kurdish forces have beaten back Isis and maintained a degree of order with American backing.

Support free-thinking journalism and attend Independent events

Mr Trump’s plea for allies to repatriate and prosecute captured jidahis came amid confusion over the fate of a British teenager who fled to Syria to join Isis in 2015.

British home secretary Sajid Javid has vowed he “will not hesitate” to prevent 19-year-old Shamima Begum returning to the UK, but justice secretary David Gauke conceded the government “can’t make people stateless”.

Ms Begum, who is heavily pregnant, is currently in a Syrian refugee camp but has said she wants to return to London.

The teenager is believed to be one of 20 UK women and children being held in camps by the SDF along with six suspected British fighters.