WASHINGTON (NYTIMES) - The escalating chaos in northern Syria as Turkey presses forward with its attack on the United States' erstwhile Kurdish allies is raising fears about the fate of thousands of detainees from the Islamic State of Iraq and Syria (ISIS) group that the Kurds have been holding in makeshift wartime prisons.

When announcing that he had cleared the way for the Turkish military operation in northern Syria, US President Donald Trump insisted that Turkey must assume responsibility for the captured ISIS fighters and their families - then said the US was taking custody of the most dangerous ones.

But with the Pentagon preparing to withdraw US forces from northern Syria, it is far from clear that either aspiration will happen.

WHAT'S GOING ON IN NORTHERN SYRIA?

The situation is deeply complicated. Turkey has launched an invasion against Kurdish-led Syrian Democratic Forces (SDF), who were the primary US ally in Syria against ISIS and who control northern Syria. Turkey has been fighting separatist Kurds inside its borders and considers the Syrian Kurds terrorists.

The presence of US troops alongside the Kurds had helped to maintain a fragile peace. But since Mr Trump told Turkey that it could begin an operation into Syria and that the US would pull its forces back from a zone along the border, Turkey and an Arab Syrian militia have killed many Kurds - and may have deliberately fired near US forces, too. On Sunday (Oct 13), the Pentagon announced that Mr Trump had ordered US forces out of northern Syria.

Meanwhile, President Bashar al-Assad of Syria, backed by Russia, controls the southern part of the country and wants to retake it all. On Sunday, the Kurds apparently struck a deal with the Syrian government, but its details - and what it would mean for detainees - were not yet clear.

WHO ARE THE ISIS DETAINEES?

The SDF has operated an archipelago of about half a dozen ad-hoc wartime detention sites for captive ISIS fighters, ranging from former schoolhouses in towns like Ain Issa and Kobani to a former Syrian government prison at Hasaka.

Related Story ISIS families escape Syria camp as Turkey battles Kurds

Related Story Turkish forces, allies seize parts of Syrian town Suluk

The prisons hold about 11,000 men, of whom about 9,000 are locals - Syrians or Iraqis - and about 2,000 come from 50 other nations whose home governments have been reluctant to repatriate them. Scores of those men are Europeans, from countries like Belgium, Britain, France and Germany, but far more come from other nations that are part of the Muslim world, like Egypt, Tunisia and Yemen.

The Kurds also operate more than a dozen camps for families displaced by the conflict that hold tens of thousands of people, many of them non-Syrian wives and children of ISIS fighters. These include the giant Al Hol camp about 40km south-east of Hasaka, where some 70,000 people have been living in increasingly dire conditions, and a camp in Ain Issa.

WILL ISIS MEMBERS GO FREE IN THE CHAOS?

One fear was that the Kurds are redeploying guards out of the prisons and camps to help fight the Turks, making it easier for ISIS members to break out. On Sunday, hundreds of ISIS women and children apparently were permitted to leave a section of the displaced-persons camp in Ain Issa where they had been detained, amid Turkish air strikes that threatened their safety. It is not clear whether any male fighters have yet escaped the prisons.

The "worst-case scenario" is that the Kurds are so frustrated and angered by the US' action that "they decide to release wholesale some of the detainees", said Mr Christopher Costa, a former senior director for counter-terrorism on Mr Trump's National Security Council who now heads the International Spy Museum.

MIGHT TURKEY OR THE ASSAD GOVERNMENT TAKE CUSTODY OF ISIS PRISONERS?

The White House said Turkey would "now be responsible for all ISIS fighters in the area captured over the past two years". But Turkey has given no public sign that it has agreed to take over that headache.

"It's hard to imagine Turkey has the capacity to handle securely and appropriately the detainees long held by the Syrian Kurds - and that's if Turkey even genuinely intends to try," said Mr Joshua Geltzer, a former senior director for counter-terrorism at the National Security Council in the Obama administration.

It is also possible that the Syrian government could end up taking over some of the prisons as a result of a deal between the Kurds and the Assad regime. But it was not clear whether there is any plan for a controlled transfer of authority and responsibility amid the fast-moving events.

HASN'T THE U.S. ALREADY GOT THE VERY WORST ISIS DETAINEES OUT OF SYRIA?

Mr Trump said that, but it was largely untrue. On Wednesday, as the chaos was intensifying in northern Syria, Mr Trump made reassuring remarks to reporters, disclosing that the US was taking custody of the worst ISIS detainees to ensure that they would not escape.

"We are taking some of the most dangerous ISIS fighters out," he said. "We've taken them out and we're putting them in different locations where it's secure. In addition, the Kurds are watching. And if the Kurds don't watch, then Turkey is going to watch because they don't want those people out any more than we do."

He added: "But we have taken a certain number of ISIS fighters that are particularly bad. And we've wanted to make sure that nothing happened with them, with respect to getting out. And I think we're doing a great job."

But even though Mr Trump spoke in the past tense, as if that operation had been carried out, it was instead largely aspirational - and now appears increasingly unlikely.

WHAT REALLY HAPPENED?

The US got only two high-value detainees out - far short of its goal.

Related Story ISIS will resurge as Trump walks away from Syria, warns former US defence secretary Mattis

The military had been making contingency plans to get a list of about five dozen of the highest-priority detainees from that group out of northern Syria since December, when Mr Trump first announced that he would withdraw troops from the country before his administration slowed down that plan, one official said.

After Mr Trump's abrupt green light to Turkey, the military tried to carry out that aspiration. And last Wednesday, special operations forces managed to take custody of two British men believed to be half of an ISIS cell that tortured and killed Western hostages and who are now being held at a US base in Iraq.

But after the Kurds acquiesced to those two transfers, they stopped cooperating with the US in anger at what they saw as Mr Trump's betrayal, according to US officials.

The Pentagon's decision on Sunday to pull US forces out of northern Syria means the opportunity to take custody of additional ISIS prisoners - even if the Kurds were to decide to start cooperating again - is rapidly evaporating, the officials said.

WHO ARE THE TWO BRITONS THE UNITED STATES MANAGED TO TAKE CUSTODY OF?

They are El Shafee Elsheikh and Alexanda Kotey - two of the so-called Beatles, a four-member cell of British ISIS members who abused Western hostages, including James Foley, the US journalist beheaded in August 2014 for an ISIS propaganda video.

Another cell member, who was later killed in a drone strike, is believed to have killed Foley.

The Justice Department intends to eventually bring the two to the Eastern District of Virginia for trial, but a court fight in Britain has delayed that transfer. The lawsuit is over whether the British government may share evidence with the US without an assurance that US prosecutors will not seek the death penalty.