DEBAGA, Iraq — In a shabby school building that has ceased to be a place of learning, families crowd the spaces that are shielded from the intense autumn sun. Women sit on pieces of cardboard to avoid the dirty floors of the school’s courtyard, corridors, and classrooms. Their children are clustered around them.

With little more than the clothes on their bodies, these families are recent arrivals at the Debaga displacement camp in Kurdish administered northern Iraq. They’ve walked through the dark of the night and the heat of the day to escape the self-proclaimed Islamic State.

These men, women, and children have staggered through the arid plains of Nineveh province, arriving here with fear and exhaustion etched on their faces. And every day more civilians seep through the front lines, a trickle expected to turn into a flood as Iraqi forces begin their assault on Mosul, the final ISIS stronghold in Iraq.

More than 100,000 people have fled the crumbling caliphate in the run-up to the battle, which could begin as soon as mid-October, and of those, according to the Norwegian Refugee Council, 62,000 fled Mosul and its environs.

Typically they paid a smuggler a few hundred dollars to navigate them through mine fields and around ISIS positions in grueling marches that push the old, the young, and the infirm to their limits. Some never make it.

When the long anticipated assault on Iraq’s second largest city begins it is expected to displace up to one million people, according to United Nations estimates. If these projections come true, the military campaign to dislodge ISIS from Iraq will kick off the most severe humanitarian disaster in recent memory, aid agencies warn.

“If the worst case scenario happens, this will be the worst humanitarian crisis—excluding genocide—since Rwanda,” says Alex Milutinovic, the International Rescue Committee’s country director for Iraq.

Already displacement camps are struggling to cope with the civilians fleeing ISIS-held areas in anticipation of the fighting. Debaga is bursting, having doubled in size since opening earlier this year, and new arrivals have to wait for days until they are allocated a tent.

“There are no showers here and we have to sleep on the floor,” says 32-year-old Umm Zain Al Abedin, who made it out of Mosul three days ago. The mother of six is worried about disease spreading in the school building, which functions as a makeshift reception center.

Umm Zain is one of the lucky ones.

Once the battle for Mosul begins, most of the civilians streaming out of the city will not find room in displacement camps. Instead, they will be led to “emergency sites” lacking in shelter and basic services, says Lise Grande, the UN’s Humanitarian Coordinator for Iraq. A total of 13 such sites are being prepared, and will—at least initially—be little more than open fields.

According to the IRC’s Milutinovic, only 35,000 additional shelter units, capable of housing a mere 200,000 people, will have been added between June and mid-November.

The UN estimates that up to 700,000 people fleeing Mosul could be in need of shelter as the winter approaches.

The inability to deal with the humanitarian fallout of the Mosul campaign, aid agencies say, comes down to money problems. A UN appeal in June for $280 million in emergency funding has so far yielded only half that amount. Short of resources, the humanitarian community was not able to prepare a response, despite knowing months in advance the rough timeline for the offensive.

“Funding is a huge issue. What we really need now is the rest of the money we asked for,” says Becky Abdullah, media coordinator for the Norwegian Refugee Council.

Preparations are also hampered by limited information on how and when the Iraqi army and allied forces will launch their attack on the city. NGOs complain that they have not been told when the offensive will begin, and where humanitarian corridors will be established to funnel civilians out of the city.

“We’re getting bits and pieces, and its changing all the time,” says Milutinovic.

From a soldier’s point of view, there’s a reluctance to give away information about strategy and tactics. But if the result is a humanitarian debacle, that will undermine the credibility of any military victory.

In any case, a coherent plan for the assault on the city has been slow in coming.

Iraq’s army is still rebuilding after the mauling at the hands of ISIS in 2014, and its top brass has to bring in line a plethora of different actors and militias that want to take part in the offensive.

This has left aid agencies second guessing how best to deploy their already limited resources.

“The timing of what we can do is linked to the military planning,” says the UN’s Grande.

With the clock ticking, NGOs will have to race to allocate their resources once the fighting sets the human tidal wave in motion. Aid agencies have the bulk of their staff and resources in the Kurdish region to the north and east, and will struggle to reach those who flee southward, a problem exacerbated by red tape and the Iraqi government’s bureaucratic inertia. According to the NRC, half of those fleeing Mosul will gravitate toward the south.

The uncertainty extends to how the cash-strapped Kurdistan Regional Government (KRG) will react to a renewed influx after taking in roughly 1.3 million internally displaced people who fled to the autonomous region in the wake of the Islamic State’s sweep through Iraq in 2014.

Aid officials and recent internal UN memos seen by The Daily Beast suggest that the Kurds are unwilling to accommodate significant numbers of new arrivals from Mosul. If the KRG stops them from entering its territory, as many as 350,000 people will be trapped in a narrow corridor of land only recently taken from ISIS.

The Kurds say it will not come to this, pointing to the work that is underway to manage a further inflow.

“We are preparing to receive people from Mosul,” says Farhad Atrushi, the governor of Dohuk province, which abuts Mosul’s northern flank. Two new camps in Kurdish territory are nearing completion, the construction contracts for a third will be awarded soon, and a fourth camp is in the planning stages, says the governor.

But a long-running budget dispute with the central government in Baghdad, low oil prices, and the two-year-long war on ISIS have left the Kurdish economy in tatters. Kurdish President Masoud Barzani has been vocal about independence from Iraq, and the Kurds are eyeing, as part of that, sizable territories that lie between Mosul and KRG territory.

While pledging to continue their humanitarian support for ther fellow Iraqis, the Kurds have limited means to help, and are wary of changing the ethnic composition in the disputed territories north of Mosul by embracing the city’s fleeing Arab population.

“We have no planned limits,” says Atrushi, “but the capacity and capability of the KRG as a government and a region is limited because of a number of factors: the war on ISIS, the economy, and the political differences with Baghdad.”

As the aid sector scrambles to minimize the humanitarian fallout from the battle for Mosul, ISIS is digging in. During the battle for Fallujah, which fell to Iraqi forces after six weeks of bitter fighting, the jihadists at first prevented inhabitants from leaving. The insurgents shot many civilians making a run for it, while others died stepping on roadside bombs.

Those who made it out were harassed by Shia militias that had formed a cordon around the city.

The sectarian militias were soon accused of torturing and killing civilians fleeing Fallujah, adding to their record of war crimes. Baghdad wields little influence over these powerful armed groups, which have announced their intention to take part in the Mosul operation.

Caught between the hammer of Mosul’s fanatical, bloodthirsty defenders and the anvil of vengeful Shia militias, those huddling on barren emergency sites during the cold winter nights may count themselves the fortunate ones.