Washington: The US military is spending about $1 million to help detain thousands of Daesh fighters and their family members in makeshift camps run by Kurdish militias in northern Syria, pulling the Pentagon deeper into the war zone detention operations it has sought to avoid.

The dilemma is unfolding even as President Donald Trump has pledged to withdraw the 2,000 remaining US troops in Syria, many of whom are vetting the most dangerous detainees, and suspend more than $200 million in State Department recovery funds for the country.

Defence Department and Kurdish officials said several thousand detainees – including at least 400 fighters from more than three dozen countries and their families, as well as other Syrian militants – were being held in several camps. The US funding is paying to erect fencing, put bars on windows and otherwise secure schools and other buildings being used as temporary jails for fighters who were captured or surrendered after last year’s collapse of Raqqa, Daesh’s self-proclaimed capital.

Military officials insist US personnel are not strengthening the buildings or guarding the detainees themselves, just paying for it.

Critics fear the facilities could become breeding grounds for extremists and repeat a key security miscue of the Iraq War. But without the US assistance, the camps lack sufficient security to prevent jailbreaks of battle-hardened militants who could reinvigorate pockets of Daesh fighters near Al Bu Kamal, a town in eastern Syria along the Iraqi border.

Syrian Kurdish officials said the camps were straining their capacity to oversee the dangerous fighters and rapidly depleting their budgets to pay for operations at the half-dozen sites in and around Raqqa. One senior US official said as many as 50 to 60 fighters were detained in a single room.

“The process has been tedious,” Kino Gabriel, a spokesman for the Kurdish-led militia known as the Syrian Democratic Forces, said by WhatsApp from Qamishli, Syria. “The interrogation is taking time, and filtering the prisoners has not been an easy task. We need all kinds of support from the international coalition.”

US diplomats and Pentagon officials are frantically trying to persuade countries to repatriate their citizen fighters who have been detained, but so far have had few takers.

“It is critical that countries take their citizens back and prosecute them in a timely manner commensurate with their crimes,” Nathan A. Sales, the State Department’s counterterrorism coordinator, said in an email. “We call on our partners to take responsibility for their citizens.”

Daesh has lost nearly all the territory it seized in Iraq and Syria in 2014. But US intelligence and military officials warn that the extremist group has pivoted to a deadly insurgency in areas it formerly controlled, and still holds sway with a potent appeal on social media for adherents from Europe to the Philippines to carry out attacks wherever they are.

Two commandos - one US soldier, one British - were killed in a roadside bombing last week in Manbij, a contested city in northern Syria.

“Although Daesh has been decimated in Iraq and Syria, its ideology still resonates globally,” David M. Cattler, the government’s national intelligence manager for the Near East, said last month. “Daesh is evolving and adjusting.”

Unlike suspected Daesh seized in neighboring Iraq - mostly from the northern city of Mosul and surrounding areas - the detainees being held in the Kurdish region of Syria fall into a legal grey area and face an uncertain long-term fate.

Kurdish authorities are parceling out justice in ad hoc courts, but the region is still part of Syria, and Kurdish control is not internationally recognized.

In a hearing of the Senate Armed Services Committee last month, Sen. Lindsey Graham raised concerns about US culpability for the growing number of fighters in the custody of the Syrian Democratic Forces.

“Do you think we have a credible plan to detain these people?” Graham asked Gen. Joseph L. Votel, head of the military’s Central Command, which oversees operations in the Middle East.

“We actually do have a plan to detain them on the ground,” Votel said. He also noted the effort to repatriate the detainees.

“If they don’t go back to their countries, do you think we have a plan - credible plan - to detain them inside of Syria long term?” Graham asked.

“We are working on improving the capacity of the Syrian Democratic Forces to do that right now,” Votel said. He offered no details, but a senior US military official said the Pentagon planned to spend about $1 million on the improvements. The funding, however, may now be in doubt, given Trump’s vow last week to withdraw troops and aid from Syria.

Still, the Pentagon has openly acknowledged the security problem.

“These aren’t necessarily the best detention facilities, in the sense of they are being held in Syria, and not in the most secure area,” Kathryn Wheelbarger, principal deputy assistant secretary of defense for international security affairs, said in February. “There were certain days where we are seeing 40 to 50 a day were being captured, so a capacity problem is very real.”

US Special Operations troops advising the Kurdish-led militia are cataloging fingerprints and other so-called biometrics of the more than 400 suspected foreign fighters in at least three camps near Raqqa. The US forces are also interrogating the detainees to learn more about foreign fighter networks and threats to their home countries.

“They’re taking the time to go through the prisoners and know who they are,” Cattler said during remarks at the Washington Institute for Near East Policy. “It’s critically important.”