Objections from humanitarian groups have already scuttled a proposal to set up a new camp near Tal Afar in the northern province of Nineveh. Senior Iraqi officials, however, remain opposed to the idea of scattering the Islamic State returnees, mostly women and children, among existing displacement camps around the area, according to high-ranking figures in the Displacement Ministry and parliament.

“The goal is to select a special place to contain those people,” said one Iraqi official, who spoke on the condition of anonymity because he was not authorized to discuss the issue. “It’s for security reasons, but also to keep them alive. If they return to their areas, they’ll be singled out for revenge attacks by people who lost relatives to the Islamic State.”

The Islamic State committed atrocities in Iraq and Syria ­during the nearly five years it controlled territory there. But its rise to power was made possible, in part, by its success in selling itself as a protector and liberator of disaffected Sunni Muslim communities, which felt marginalized by the governments and security forces of those countries. How the Iraqi government proceeds in the coming weeks could have far-reaching consequences for whether those wounds can be closed or whether the sense of grievance only deepens.

Officials in Baghdad have spent months negotiating a deal to repatriate just more than 30,000 civilians who are now under the control of Syrian Kurds, allied with the United States, who have neither the means nor desire to continue holding them.

The Iraqi families had spent years living under the Islamic State’s self-declared caliphate, moving to Syria as the militants lost their Iraqi foothold and then leaving the proto-state only as it crumbled. Now, they are packed into the teeming al-Hol displacement camp in northern Syria as Iraqi officials decide their fate and aid groups look on with alarm. The Iraqis represent more than two-fifths of those held at al-Hol and are by far the largest group other than Syrians themselves. Iraqi fighters who have been captured are now jailed in either Syria or Iraq.

To date, the Iraqi government has shown an unusual willingness to repatriate citizens who signed on with the Islamic State. Most other countries — in Europe, the Middle East, North Africa and elsewhere — have been reluctant to bring their nationals home amid security fears that continued to spike after the recent devastating attacks in Sri Lanka, for which the Islamic State has asserted responsibility.

About 20,000 Iraqis have voluntarily returned to Iraq since the start of the fight against the Islamic State, humanitarian officials say. More than 1,700 families at al-Hol have also registered with the United Nations for voluntary repatriation, according to humanitarian agencies. The timeline for their return remains unclear, and they are expected to be transferred in batches over an extended period.

“We’re doing everything we can to avoid the prison camp scenario,” one aid worker said, speaking on the condition of anonymity because of the sensitive nature of the topic. Humanitarian groups are urging that the returnees be placed in four ­existing camps, where the United Nations already provides food, medical care and other services.

Fear and resentment

The challenge, recognized by Iraqi officials as well as aid groups, is how to map out a future for the returnees that does not involve indefinite confinement. In existing camps in northern Iraq, families displaced by previous waves of fighting already fret that they cannot go home, citing fears of violent retribution by militias or neighbors the Islamic State had displaced.

Tens of thousands of Iraqis with alleged links to the Islamic State — some to its fighters, others to civil servants who kept working when the militants rolled in — have been languishing in those camps for several years. Their experience underscores the dangers of a prolonged stay in the camps. But it also highlights the barriers to leaving or reintegrating into Iraqi society.

“The biggest concern for us now is that some of our camps are fostering the best environment for a new extremism,” said an Iraqi aid worker whose group is funded by the government. “Even if a family is innocent, it is now being looked at with hatred by [Iraqi] society accusing them of being ISIS families. The government achieves the same by not issuing them papers or giving them proper schools. . . . Organizations will recruit them selling the idea of revenge.”

In the sprawling Khazir camp near Irbil, its roads churned to mud after heavy spring rains, families with ties to the militant group see no good options. They say that staying in the camp would leave them permanently displaced and vulnerable to exploitation by armed groups and predatory camp officials.

The Khazir camp near Irbil, Iraq, already holds thousands of internally displaced Iraqis. (Mohamed El-Shahed/AFP/Getty Images)

Inside the camps, women who lost their husbands to airstrikes or prison say they are targeted for sexual violence, by militiamen and camp guards, or forced marriage. Kawakip, 40, who now lives in the Khazir camp, said that two of her daughters had recently been coerced into short-lived marriages with camp outsiders after guards let them in to choose a wife. In a nearby tent, another family said the same had happened to three of their children.

“These marriages are just sex marriages, but you can’t say no,” said Muntahar, a girl in a floral dress who looked younger than her 16 years. She pointed to a divorce certificate from February. “Then they take you for a week, or for a few months, before throwing you back into the camp. They just tell you, ‘You’re a daughter of ISIS. I don’t want you anymore.’ ”

After visits to the camps last year, researchers from Amnesty International said they had witnessed a deepening sense of resentment among families accused of links to the Islamic State. “There was a real lack of faith and often extreme fear,” said Razaw Salihy. “There was a real belief that the government knew exactly what was happening to them, and that it constituted a punishment.”

Dangers of going home

But leaving the camps can be daunting and expose families to violence by mostly Shiite militias — known in Arabic as the Hashd — that had battled the Islamic State, a radical Sunni group.

“We were told that the Hashd would rape our daughters if we tried to go home,” Kawakip said. “I tried to cross a checkpoint to get to the documentation office so I could get permission to return home, but they stopped me at a checkpoint. They told me they’d kill me if I came back and tried again.”

A variety of armed groups, including Sunni tribal and Shiite militias, control territory that many of the returnees would have to traverse to get home. Many of these militias have escalated their threats to block people with a “first degree” connection to the Islamic State — perhaps a brother, father or sister — from going back to their areas of origin.

Moreover, babies born in the time of the caliphate lack official Iraqi birth certificates, meaning the children have no government recognition and could be shut out of Iraq’s education system ­forever.

During visits to four displacement camps, members of every Islamic State-connected family interviewed said they had been threatened by Iraqi officials when trying to procure documentation for children born in areas controlled by the group or to replace documents that had been damaged or stolen. These refugees spoke on the condition that their full names be withheld because they feared further retribution.

A senior aid official at al-Hol said Iraqi officials are becoming increasingly suspicious that returnees from Syria pose a hostile threat. For their part, many Iraqis at al-Hol, after years of Islamic State indoctrination and menacing statements by Iraqi militias, fear they could be killed if they go back across the border.

“Iraqis within the camp itself have started to unregister from returning because of this rhetoric and concern about what might happen to them,” the aid official said.

Human rights activists and Western diplomats say that returnees who remained with the Islamic State until its final stand are those most likely to be treated as social outcasts by other Iraqis. Any camp built explicitly for repatriated families, the activists and diplomats warn, risks fueling the same grievances that aided the group’s rise in the first place.

“It’s important to look at families who had alleged links to ISIS and to look at the reasons that might have happened. One of the reasons these families have always told us is it that they felt marginalized, they felt like they were from communities the government didn’t care about or that was targeted with impunity,” said Belkis Wille, a researcher at Human Rights Watch.

But Sheikh Mohammed Nasser al-Bayati, a commander with one of northwestern Iraq’s most powerful Shiite militias, expressed little sympathy for those who might try to return to their hometowns or villages.

“Well, I’m afraid we won’t be able to stop the people from attacking them,” Bayati said as he sat in his group’s base in the city of Tal Afar last week. When asked about returnees from Syria, he bristled. “They should all be prosecuted or killed,” he said.