A transnational group of religious fanatics rolled over Iraq’s borders in 2014 with jeeps and guns and an all-pervasive claim on the Islamic faith.
From the old al Nuri Mosque in Mosul, the self-declared caliph of Islamic State, Abu Bakr al Baghdadi, declared himself leader of all Muslims and promised to conquer the West.
The war did not work out the way al Baghdadi envisaged. Islamic State fighters were killed or scattered by Iraqi and Kurdish soldiers and coalition airpower.
But the allied victory has come at an incalculable cost. More than 40,000 people died in Mosul alone and large parts of Iraq have been wrecked.
Along with the destruction and the oversize refugee camps and a lack of basic services, Islamic State fighters have left something else for Iraqi officials to deal with – their wives and children.
Officials told Sky News they are currently holding 3,000 IS family members, including 1,750 foreign women and children.
These foreign nationals have been detained in a high-security prison in a town called Tal Keif, 10 kilometres northeast of Mosul.
The conditions are poor – the prison’s capacity is 500 – and officials from the interior ministry in Baghdad told us they are trying to convince home countries to take some of them back.
But the chief adviser to the ministry, Dr Wahab Altaey, says it has been a struggle.
“The majority of countries have not responded to us in a positive manner. They did not accept the idea of receiving the dependents – the wives. The boys are considered to be ticking bombs.”
Dr Wahab accepts that some IS family members, who come from dozens of different countries, will never return home.
“We are trying to divide them into groups – those that can be extradited and those who will remain in Iraq. We have to deal with them all (of them) in a humane manner.”
Sky News was given permission to speak to four Europeans currently held at Tal Keif. It was soon clear to us that some women had embraced life under Islamic State.
Kheda, a mother-of-three from Hamburg in Germany, told us why she joined IS: “We were wearing the burqa in Germany because it is not forbidden but they were making fun of us, insulting us.
“They asked us, ‘Why do you hang around like that?’ But no one can criticise our burqas or our covering up.”
Yevgenia from Volgograd in Russia said she too preferred the self-declared Islamic caliphate.
She said: “You wear black, you take care of your kids and people don’t push you or point fingers at you when you go to the market. There was no problem there.”
I asked her whether she knew about the atrocities, executions and sheer terror perpetrated by Islamic State.
The mother added: “Tell me honestly, how would you describe people who drop bombs on civilians? How many women and children were killed? It’s a controversial thing when you ask who are the terrorists.”
While Yevgenia and Kheda’s comments and combativeness will raise concerns with many, there is no international strategy to deal with people like them.
Instead, most countries prefer to ignore the issue – the rehabilitation and reintegration of returnees is simply considered too difficult.
In contrast, a French prisoner called Jamelah told us she was revolted by her experience with IS.
She claimed that she had been tricked by her husband into taking a holiday in Turkey. Instead, he was preparing for a life of jihad in Syria.
“I wanted to escape but it was impossible. After three days in Istanbul I knew it was impossible. I had no mobile, no internet, what can I do? He did training in Raqqa, 36 days. (Then) they decided where they needed families. If they needed men in Mosul, they brought all families to Mosul.”
Jamelah and her daughter were part of a group who surrendered to Kurdish fighters in Tal Afar in July. She told me she has received one phone call from French consular officials and described the situation as hopeless.
“All my life is prison. What can I do? What can I say? I am tired. Really. Up until now my life is prison. I want to be strong, not for me, just for my daughter.”
There seems little prospect that Jamelah and the other foreign nationals (1,050 children and 700 women) will be released soon – despite the interior ministry’s intentions.
A senior Iraqi military official told Sky News he considered these women and children to be terrorist threats. Their continued incarceration was necessary, he added, to prevent members of the local Sunni community from aiding in their escape.
Nobody has had to fight a war like this – and no one, it seems, knows how to deal with the aftermath. The Iraqi government is split and the international community has turned its back – while 3,000 outcasts remain behind bars.