Many of them were barely school age when their parents took them to the Islamic State group's so-called caliphate in Iraq and Syria. Thousands of others were born there.
The children of the group's followers are the most vulnerable of the Islamic State's human leftovers — the remainders of the more than 40,000 foreign fighters and their families who came from 80 countries to help build the caliphate. Many are now detained in camps and prisons across eastern Syria, Iraq and Libya.
"What have these kids done?" said Fabrizio Carboni, a Red Cross official, after witnessing the misery surrounding him on a recent visit to Al Hol camp in Syria. "Nothing."
Yet even when it comes to the children, the foreign governments whose citizens are marooned in the camps and prisons have struggled with what to do with them.
The Islamic State group, researchers say, employed children as scouts, spies, cooks and bomb-planters, and sometimes as fighters and suicide bombers. Propaganda videos showed young children beheading and shooting prisoners.
Some have had years of Isis indoctrination and, in the case of older boys, military training.
"They're victims of the situation because they went against their will," said Peter Neumann, director of the International Center for the Study of Radicalisation at King's College London, "but that doesn't mean that they're not, in some cases at least, a risk."
If figuring out what to do with the children is that complicated, deciding what to do with the women and men is even more difficult.
There are at least 13,000 foreign Isis followers being held in Syria, including 12,000 women and children. That number does not include the estimated 31,000 Iraqi women and children detained there. Another 1,400 are detained in Iraq.
But only a handful of countries — including Russia, Kosovo, Kazakhstan, Indonesia and France — have intervened to bring back some of their citizens.
In a crowded Syria tent camp, the women and children of Isis wait in limbo
He was trained by Al-Qaida to bomb the subway, then he switched sides
The remote Sri Lankan enclave that produced the mastermind of a massacre
The debate is more pressing than ever.
In overflowing camps in eastern Syria, the wives and children of Isis fighters who fled the last shreds of Isis territory are dying of exposure, malnutrition and sickness. Children are too spent to speak. Women who have renounced the group live in dread of attacks from those who have not.
The local militias running the camps say they cannot detain other countries' citizens forever.
Across the border in Iraq, government authorities are administering hasty justice to people accused of being Islamic State members, sentencing hundreds to death in trials that often last no longer than five minutes.
But most foreign governments are reluctant to take them back, leaving them international pariahs wanted by no one — not their home countries, not their jailers.
"Who wants to be the politician who decides to repatriate Individual A who, two years down the road, blows himself up?" said Lorenzo Vidino, director of the George Washington University Program on Extremism.
The fact is, Vidino said, few extremists return to stage attacks in their home countries. But the exceptional cases — including the 2015 Paris attacks that killed 130 people and two of Tunisia's deadliest terrorist attacks — have made the idea of repatriation politically toxic in many countries. At least one of the bombers who carried out the attack in Sri Lanka on Easter was a Sri Lankan who had trained with the Islamic State group in Syria.
Some countries, like Britain and Australia, have revoked the citizenships of their nationals suspected of joining the Islamic State abroad, effectively abandoning them and their children to indefinite detention without charge and potential statelessness. Britain alone has cancelled the passports of more than 150 people, the home secretary, Sajid Javid, has said.
While bringing them home could pose an obvious danger, so could leaving them in the camps, desperate and disenfranchised.
Historically, fighters who gained experience with one extremist group have been the ones who seed new ones, said Seamus Hughes, deputy director of the George Washington program.
"Do we ignore the problem because it's easier in the short term?" he said. "If so, it's going to become a problem in the long term."
But bringing them home requires foreign governments to answer virtually impossible questions, like how to separate those who committed crimes from those who did not, and those who still pose a threat from those who do not.
The puzzle has been hardest to solve when it comes to the tens of thousands of women and children affiliated with the Islamic State group.
The once common view that Isis women were passive prey, "jihadi brides" seduced into joining the caliphate and marrying its fighters, crumbled as evidence emerged that women had served as enforcers for the caliphate's morality brigade or, in some cases, taken up arms in battle.
"The rhetoric from the media and politicians is they're brainwashed, they're deceived, they're lovestruck, they don't know what they're doing," said Meredith Loken, an assistant professor at the University of Massachusetts at Amherst who has studied women who join violent extremist groups. "But even if they didn't pick up guns," she said, many were "actively contributing to this group."
Some were reluctant accessories while others were violent zealots. Some were both victims and perpetrators, experts say.
Women like Shamima Begum, a British teenager, and Hoda Muthana, a young American-born woman, have drawn headlines in recent weeks partly because it is so difficult to size up their roles and the risk they pose.
Begum was unrepentant when a journalist found her in a Syrian camp in February, asking to return to Britain for her unborn child's sake while insisting that the 2017 Manchester Arena bombing, in which 22 were killed, was justified. Muthana later said she regretted joining the Islamic State group, insisting that she had been "brainwashed."
Experts contend that bringing Isis members home to be prosecuted or monitored is smarter, safer and, in most countries, more humane than leaving them stranded in the desert or outsourcing their prosecution to the Iraqi justice system.
The Trump administration has called for foreign governments to repatriate their citizens, though officials have suggested that some detainees who cannot be repatriated could be sent to the military prison at Guantánamo Bay.
"They are your citizens, and, for better or for worse, you're responsible for the mess they're creating," said Tanya Mehra, a researcher at the International Center for Counter-Terrorism at The Hague.
Some countries say that Iraq should be able to prosecute foreign Isis members for crimes against Iraqis committed on Iraqi soil. The US-backed forces in Syria have handed over at least 150 Iraqis and foreigners to be tried in Iraq.
Yet Iraqi due process standards fall glaringly short of Western ones. Many defendants have been convicted on the basis of confessions extracted through torture, including, according to Human Rights Watch, teenagers who said that they were beaten until they confessed.
Iraq's Supreme Judicial Council has said that at least 185 foreign children had been convicted on terrorism charges and sentenced to prison by the end of 2018. Iraq is also negotiating with the Kurdish-led militias who oversee the camps in Syria for the return of the 31,000 Iraqi women and children but Iraq's government has been unable to decide what to do with them.
Abandoning Isis followers to the camps or to Iraqi justice, experts argue, may only postpone a reckoning later on.
"If you leave them there and you lose track of them, sooner or later they'll try to come back and you have no clue what's happened with them," Mehra said. "At least it's a controlled risk if you bring them back."
Several countries have proposed an international tribunal to try Isis suspects. While the idea has gained some traction among countries eager to avoid handling the problem themselves, other international tribunals — which have generally tried only top officials — have proved unwieldy, expensive and of limited effectiveness. Experts view the prospect as unrealistic.
Prosecution at home is also complicated.
Many countries were so unprepared to deal with returnees that they did not have laws to prosecute them until a few years ago; even now, those laws generally carry sentences of only a few years.
Successful prosecution often requires resources that are hard to scrape up and evidence that has long since disappeared on the battlefield.
Countries have also struggled with imprisoning former Isis fighters in a way that prevents them from radicalising other prisoners, and then reintegrating them into society once they are released.
While no nation has yet developed a large-scale, tried-and-true model for detention — to say nothing of deradicalisation, which remains an elusive goal — Neumann, the radicalisation expert, said that those that have developed a more sophisticated approach have found that it often requires labour-intensive, case-by-case tailoring.
Some governments have appeared more willing to repatriate children than their parents, though few seem ready to send people to Syria and Iraq to collect them. Several countries require children born in the caliphate to undergo DNA testing to prove their parentage, and therefore their citizenship, before repatriation.
Kosovo, Russia and Kazakhstan are among the few countries that have retrieved children on a large scale, with the Chechen ruler, Ramzan Kadyrov, organising the return of dozens of Russian-speaking children and, in some cases, their mothers. In the largest one-time repatriation to Europe so far, Kosovo flew 110 of its citizens back from Syria last month, including 32 women and 74 children.
To help reintegrate them into society, some countries have favoured separating children from radicalised parents and placing them with relatives or in foster or adoptive homes. While this approach may be the fastest way to rescue innocent children, it also means tearing them away from their mothers, many of whom refuse to part with them.
Tunisia, which had one of the largest contingents of foreigners to join Isis, has balked at repatriating its citizens, leaving at least 200 Tunisian children and 100 women marooned in Syria and Libya, according to Human Rights Watch.
It has taken months of urging by activists and families for Tunisia to repatriate three children, including a 4-year-old who was orphaned when his parents were killed in airstrikes and two children whose mother remains detained in a camp, the rights group said.
"Every day they spend in the camp is one more day outside of school and their fundamental rights," said Khawla Ben Aicha, a member of Tunisia's Parliament who has pushed the government to retrieve the rest of the children. "They didn't choose where they were born, or to have a jihadist parent."
But the fragile Tunisian government has stalled, despite calls from Ben Aicha and others for it to take responsibility.
"We're in an election year," Ben Aicha said. "It's not something people want to deal with."
Written by: Vivian Yee
Photographs by: Ivor Prickett
© 2019 THE NEW YORK TIMES