TUNIS, Tunisia - Hundreds of children fathered by the Islamic State's foreign fighters or brought to the self-proclaimed caliphate by their parents are now imprisoned or in limbo with nowhere to go, collateral victims as the militant group retreats and home countries hesitate to take them back.
One young Tunisian orphan, Tamim Jaboudi, has been in a prison in Tripoli, Libya, for well over a year. He passed his second birthday behind bars and is nearing another, turning 3 on April 30. His parents, both Tunisians who left home to join the Islamic State group, died in American airstrikes in Libya in February 2016, according to the child's grandfather, who is trying to win the child's return.
Tamim now lives among two dozen Tunisian women and their children in Tripoli's Mitiga prison, raised by a woman who herself willingly joined the Islamic State group. The captives are under guard by a militia that tightly controls access to the group despite repeatedly claiming they have no interest in preventing their return home.
"What is this young child's sin that he is in jail with criminals?" asked Faouzi Trabelsi, the boy's grandfather who has travelled twice to Libya to see the boy and twice returned home emptyhanded. "If he grows up there, what kind of attitude will he have toward his homeland?"
European governments and experts have documented at least 600 foreign children of fighters who live in or have returned from IS territory in Syria, Iraq or Libya. But the numbers are likely far higher.
The children and families often find it impossible to escape IS-held areas. And even if they do, their native countries are deeply suspicious and fearful of returnees - sometimes even children. Tunisia, France and Belgium have all suffered major attacks from trained IS fighters, and Western intelligence officials have said the group is deploying cells of attackers in Europe.
Although the Islamic State group says women have no role as fighters, France in particular has detained women returnees and some adolescent boys who it believes pose a danger. Young children often go into foster care or end up with extended family. In the Netherlands, anyone over nine is considered a potential security threat, since that is said to be the age IS extremists begin teaching boys to kill.
In Libya, their fate is particularly uncertain. The North African nation descended into chaos after the 2011 civil war, which ended with the killing of dictator Moammar Gadhafi. The country has been split into competing governments, each backed by a set of militias, tribes and political factions. Militias in December captured the main IS stronghold in Libya, Sirte, effectively breaking the group's efforts to build territory there, at least for now.
Tunisia is working to bring back the women and 44 children held in Tripoli and elsewhere in Libya. But so far the only result has been repeated hold-ups and miscommunications.
"There is no wrong in being born in a conflict zone. Once their Tunisian citizenship is confirmed, they will have an individual treatment," said Chafik Hajji, a Tunisian diplomat who handles the cases of the country's citizens who joined IS.
Meanwhile, the women and children are held in a "big and comfortable" space in the prison, according to Ahmed bin Salem, spokesman of the Libyan militia that runs the facility. The prison was set up several years ago in a building inside Mitiga Air Base, a military facility that is now also used for commercial flights -including daily ones from Tunis - because it is the only functioning airport in Tripoli.
Few if any of the women and children at Mitiga or another group of 120 foreign women and children jailed in the city of Misrata in Libya have valid ID papers, according to Hanan Salah, a Human Rights Watch researcher who specializes in Libya.
While it is unclear how many children were born in IS territory in Iraq, Syria, Libya and elsewhere, a snapshot of the group at its height showed as many as 31,000 women were pregnant at any given moment, many of them wives of jihadis encouraged to have as many babies as possible to populate the nascent caliphate, according to the Quilliam Foundation, a British counter-extremism research group.
Quilliam researcher Nikita Malik said 80 British children were inside Islamic State territory. France estimated 450 of its children, including around 60 born there; Dutch and Belgian intelligence each estimated 80 children.
"In the long term, there is the new generation of ISIS, of Daesh. These are the newborns, the children of the marriages," said Mohammed Iqbel, whose Association of Tunisians Trapped Abroad advocates for the families of those who have left. "And if we don't save them, they will be a new generation of terrorism."
By many estimates, Tunisia sent more jihadis to the war zones than any other country, with official figures at 3,000 and some analysts doubling that number.
Trabelsi's daughter and son-in-law were among them.
His forehead bearing the bruise-colored mark from prayer, Trabelsi spoke with The Associated Press in his spotlessly clean living room in Tunis. Outside, the neighbourhood was rough at the edges, its streets pitted with neglect. Around the corner, adolescent boys brawled as a crowd watched.
Trabelsi's daughter, Samah, married a young man from the neighbourhood after a monthlong courtship, he said. The newlyweds left for Turkey, a common jumping off point for Europeans and North Africans joining extremist groups.
Tamim was born there in April 2014. The couple returned to Tunisia, then went on to neighbouring Libya, where they remained for two years, he said.
The Islamic State group paid particular attention to recruiting families, boasting that it would build a society that would endure for generations. Its early propaganda showed children eating sweets and playing in peaceful streets. Foreign fighters who brought wives and children were told their housing and utility bills would be covered, with money for food. Their children, they were told, would grow up to be "true Muslims."
To reassure recruits, an Australian doctor appeared in a widely viewed propaganda video that showed a pristine neonatal clinic in Raqqa.
Reality was another story. The families of foreign fighters, in many cases, took over the homes of Syrians who had fled. Movement was highly restricted, and medical care was rudimentary at best, according to court testimony and interviews from former recruits who have returned.
For foreign recruits in particular, extricating themselves has proven exponentially more difficult than joining.
Tamim's mother made it out once, Trabelsi said, but she was demoralized by what he described as harassment from Tunisian intelligence agents. His daughter gave no warning before she left for the second time, he said. She took all her documents and nearly all the family photos.
A copy of her ID card shows a veiled young woman gazing directly at the camera.
When she did call, she said nothing about where they were, Trabelsi said. "Her husband told her to be quiet and not to tell us anything."
The couple was among at least 40 people killed in a U.S. airstrike on an IS training camp in the city of Sabratha in February 2016. The Pentagon at the time said the target was Noureddine Chouchane, a Tunisian suspected in a 2015 attack on the Bardo Museum in Tunis in which 22 people died.
Six months later, word filtered back to his grandfather that Tamim was alive and in Mitiga. He began pressing to get him back.
A low point came when Trabelsi was permitted to take Tamim outside the prison and sit with him in a car. He wondered, he said, if he should just drive away with the child, who by now was closer to the prison warden than his own grandfather.
"He is clean, he is in good shape. They told me they bring him out to play and see other children," he said. "But he should be allowed back. He is in a prison."
Salah, the Human Rights Watch researcher, said that for both the Tunisians and the Libyans, keeping the women and children in the prison "is the easy way out, and that's what we object to."
Over a month ago, Tunisian officials pledged on a national talk show to bring Tamim home that very week. They never even left.
One problem is that the Tunisian government is reluctant to deal officially with the militia that runs Mitiga prison since it is not a government body, while the militia demands the Tunisians talk to it directly.
Last week, an unofficial Tunisian delegation went to negotiate for the children, only to be turned back by the Libyans because it did not get permission prior to the visit. On Wednesday, another delegation was due at the prison but the visit was cancelled when the group demanded to see the families and transfer them on the same day without going through proper procedures, according to the militia's spokesman bin Salem. He said the delegation also failed to show up on time.
Meanwhile, the women and children had been brought to an auditorium to wait in vain.
"As a government, they are not paying attention to us," Asmaa Qoustantini, cloaked in a black abaya and veil hiding her face, said while holding a toddler with pink bows in her hair. She spoke to a handful of Libyan cameras allowed into the room by the militia.
Security officials say they find themselves forced to treat children of IS parents both as victims and as potential threats.
Louis Caprioli, France's former anti-terrorism chief and an executive at the risk firm GEOS, said the fear is the children of foreign fighters will ultimately feel they should continue the fight started by their parents. He asked: "How are these children going to evolve?"
For Trabelsi, the question is irrelevant. He wants Tamim home with him or to stay with him in Libya.
"It was your government's airstrike that put Tamim in the prison," he told an American reporter. "The least you can do is help get him out."
Associated Press writer Maggie Michael in Cairo contributed to this report.