BAGHDAD — Iraq proceeded Monday with the closure of one of its final camps for families displaced during battles with the Islamic State, residents and a local official said, leaving thousands in a scramble to find shelter.

Three years after Iraq officially defeated the Islamic State, tens of thousands of civilians remain stranded in displacement camps across the country, unable to go home because they no longer have one or because familial ties to any member of the militant group leave them open to reprisals from communities it sought to destroy.

Prime Minister Mustafa al- ­Kadhimi has promised to resolve the displacement crisis by closing Iraq’s camps and finding ways to reintegrate their residents into wider society.

But the pace of recent camp closures has alarmed humanitarian groups, which say that residents are often not given enough warning — what used to be months’ notice is now a matter of days — leaving them unable to find safe harbor and, in some cases, forcing them to sleep on roadsides or on rooftops in the rain.

On Monday, authorities began gradually vacating the Jeddah 5 displacement camp in Nineveh province. Residents said security forces had entered the facility, home to 7,000 people, and told families uprooted from three villages in the province to leave or be ejected.

Most of Iraq’s displaced are women and children. More than a dozen camps are still open in Iraq’s semiautonomous region of Kurdistan, housing 182,000 people.

“They told me to leave with dignity or be dragged from my tent,” said one man in Jeddah 5, reached by phone and speaking on the condition of anonymity because he feared retribution from security forces if he was known to have spoken to a journalist.

The 45-year-old said he was attempting to sell his wife’s earrings, among their last remaining valuables, to drum up enough money to rent a truck and take his family of 12 out of the camp. He did not know where he was going to stay or how they would afford the rent.

Another resident, who spoke on the condition of anonymity for the same reasons, said families had been crying as they packed up their belongings. “We’re not asking for anything but to stay in this tent. It’s so cold here,” he said.

“Iraq used to feel like such a big country, but today it feels small. There is no place for us here anymore.”

A spokesman for the Ministry of Migration and Displaced, Hassan al-Allaf, said all departures from the camp have been consensual. “People are lying and trying to ruin our work. There is no forced return, only voluntary return,” he said.

The controversy surrounding Iraq’s camp closures speaks to the complexity of a wider problem: how to stitch societies back together in the aftermath of a war.

In its battle for land and religious supremacy, the Islamic State killed tens of thousands of Iraqis and launched a genocide against the minority Yazidi group. About 6 million people were displaced in the fighting, and although most have returned home, almost 250,000 were still in displacement camps last fall, according to aid groups.

As Iraq’s camps have closed, dozens of residents interviewed by The Washington Post expressed terror and anxiety over their uncertain future.

In Jeddah 5, residents said they had discussed the possibility of suicide with friends. Many lacked the documentation necessary to access state services outside the camp. In some cases, relatives who left to test the waters outside have been arrested at checkpoints.

But within communities to which the government is urging the last displaced civilians to return, there are fears that families with links to the Islamic State may present a security risk.

“It’s not unreasonable to be scared. We know what they did to us,” said Khoder Ahmed Ali, a resident of Dujail in Salahuddin province. “The damage is too great. We cannot accept each other.”

Hassan al-Allah, Nineveh’s deputy governor, said he had told ­more-senior officials that the camp closures augured problems for the future.

“The government didn’t study the reality on the ground,” he said. “We have serious concerns about the consequences of this decision. Maybe the headline looks positive, but the impact will be disastrous.”