A woman walks through the heat at a camp for the internally displaced from Fallujah. (Ali Arkady/VII for The Washington Post)

The family thought they had safely escaped Islamic State-held Fallujah, letting out cries of joy when they reached the outskirts of the city. But moments later, horror struck when someone accidentally triggered a roadside bomb placed by militants now barricaded in the city.

“It was a terrifying scene,” said Ayman Farouk, 17, who was injured on the back of his head by flying shrapnel. “People were lying on the floor in their blood. They were crying for help.”

Four of his cousins died — all children. Others lost limbs and had to be carried for half an hour before they reached territory held by the Iraqi army.

As Iraqi forces attempt to recapture Fallujah, held by Islamic State militants for more than two years, civilians face a gamut of dangers as they flee the city. In addition to the explosives planted on Fallujah’s streets, the Islamic State has tried to prevent residents from escaping in order to keep them as human shields. One man described how militants on motorbikes chased his relatives as they tried to leave, shooting three of them dead.

Aye Farooq Jaffar, 10, from Al Nassafarea-Fallujah, recives medical care after she survived an IED explosion while evacuating Fallujah. (Ali Arkady/VII for The Washington Post)

For those who make it to safety, the hardship continues, with aid agencies and the Iraqi government so stretched that even drinking water is in short supply. More than 3.4 million Iraqis were displaced by the conflict with the Islamic State even before the operation to retake Fallujah began, and that number is expected to grow when Iraqi forces move on to attack the larger city of Mosul.

“The way out is riddled with snipers and explosives,” said Karl Schembri from the Norwegian Refugee Council, which works in camps for the displaced. “They come to find safety at great risk, but we are struggling to get them even the most basic assistance. We are completely overstretched.”

Iraq’s government is in the midst of a severe economic crisis caused by a global crash in oil prices, while the United Nations’ $861 million appeal for humanitarian work in Iraq this year is only 30 percent funded. Much of the international assistance provided in the country is focused on more-secure areas in the northern region of Kurdistan.

In the desert surrounding the town of Amiriyat Fallujah, just 15 miles south of Fallujah, camps for the displaced are being hastily constructed. Dust storms whip through the rows of sand-laden tents. Latrines and cooking facilities are still being built, and there is no electricity.

“We don’t have stoves to give them, food is running out, drinking water is running out,” Schembri said. “We are just days away from running out of everything.”

Children cover their eyes from dust. (Ali Arkady/VII for The Washington Post)

International standards stipulate that refugee camps provide 10 liters of drinking water a day per person. The camps south of Fallujah are providing just three or four liters a day, Schembri said, even as temperatures climb above 100 degrees. Some of the displaced complained that the water they are getting is salty.

Adding to their plight, men who have fled have been detained en masse by Shiite militias and security forces, leaving many families wondering whether they will see loved ones again.

Dowlat Abed Farhan, 40, who arrived 11 days earlier from the Azrakiyah neighborhood west of Fallujah, said she wouldn’t mind the conditions if her male relatives were with her.

She said the 13 male members of the group she fled with, including her four brothers, were detained by a Shiite militia after they escaped Fallujah.

“What kind of life will we have?” she said. “We want to know where they are, if they have been beheaded or are alive. We don’t know anything.”

Next to her, Asia Radhi, 38, said 70 members of her tribe were missing.

Fallujah is a Sunni-majority city, and residents have been accused of being sympathetic to the Sunni Islamic State militants. Shiite militias have been excluded from the operation to retake Fallujah because of fears of sectarian revenge attacks if they were to enter the city.

But militia forces are still present on the outskirts.

About 643 civilians fleeing Saqlawiyah, west of Fallujah, have gone missing at the hands of militia forces, according to Sohaib al-Rawi, the governor of Anbar province. Some 49 have been killed, he said. He called for an in-depth investigation and for the armed groups responsible to be removed from the area.

A family from al-Husay, southwest of Fallujah. (Ali Arkady/VII for The Washington Post)

Men from Fallujah who reach Iraqi army lines are screened by Iraqi intelligence officials. A total of 7,181 men have been detained, said Falah al-Issawi, chairman of the screening committee. Of those, 4,100 have been released and 1,030 have been referred to the judiciary for suspected ties to the Islamic State, he said. About 2,000 remain in a makeshift screening center, waiting to hear their fate.

They are held in a warehouse near Amiriyat Fallujah. Issawi said conditions are difficult but have improved.

“We are trying to make it as good as possible, but the infrastructure is not good. It wasn’t built to be a detention center,” he said.

Journalists are restricted from accessing the center, but Salim al-Jabouri, speaker of Iraq’s parliament, posted a video online of a recent visit.

“I heard some of you have been tortured,” he said to the men sitting crowded on the floor.

“All of us,” some responded.

Nisreen Lefteh, 27, said three of her relatives were released after screening, but her husband is still being held.

“We fled from the injustice of Daesh, and now he’s facing injustice here,” she said, using a name for the Islamic State derived from its Arabic acronym. She said he’s a wood seller and has nothing to do with the militants.

She said her family was shot at by the militants during the journey out of the Naymiyah neighborhood of southern Fallujah as they took a boat along the river. In recent months, food had become so scarce that they were eating little more than dates and crudely made bread.

Lefteh said she lost a baby in the last month of her pregnancy when an airstrike hit a building while she was in a nearby market.

“Families are now under that destruction until this moment in Fallujah,” she said.

Children inside the medical center near Fallujah look out through a fence. (Ali Arkady/VII for The Washington Post)

There are no accurate estimates of how many civilians remain trapped in the city. Last week, the United Nations revised its figures to say that as many as 90,000 could be stuck inside.

More than 32,000 people have fled, according to the Norwegian Refugee Council. More arrive each day, with an additional 880 making it out by the early hours of the afternoon on Tuesday, the group said.

For the most part, those who escape are not allowed to leave Anbar province. Checkpoints to the majority-Sunni province have started to resemble border crossings, where hundreds line up for permission to exit.

Medical assistance is scarce, and many who have fled need treatment for conditions related to malnutrition such as anaemia, aid agencies say.

Farouk’s head wound was treated at a medical center run by Dary, a local Iraqi charity, in coordination with the World Health Organization. His younger sister, Aya, 10, winced as a doctor cleaned a shrapnel wound on her foot.

“When we left, we were celebrating,” she said. “But then the bomb exploded, and it was tragedy.”

Mustafa Salim contributed to this report.