Cape Town, South Africa, a city roughly the size of Los Angeles, is about to run out of water — completely.

Authorities are warning that as soon as July 9th — which they’ve ominously dubbed “Day Zero” — the drought-stricken city will have to cut off taps to all homes and most businesses, leaving nearly all of the city’s 4 million residents without access to running water.

Residents will then have to go to roughly 200 collection points scattered across the city to collect strictly rationed water. People will be allowed just 25 liters — about 6.5 gallons — of water a day. That’s all the water they’ll have for drinking, bathing, flushing toilets, and washing their hands.

Some services like hospitals, clinics, and schools will be exempt from the cutoff and will continue to have access to running water. But the overwhelming majority of the megacity’s residents will have to work with their tiny daily allotment.

Experts say the possibility of civil unrest is high. South Africa is the most unequal country in the world in terms of income, and Cape Town has the highest murder and robbery rates in the country.

So what’s going on? How does a major, modern city in 2018 completely run out of water? And what will happen if and when it does?

How did things get this bad in Cape Town?

The story of how Cape Town went dry is remarkable because up until a few years ago, the city was held up as an example of a place with particularly sophisticated water conservation policies. Cape Town has been proactive in coming up with new ways to conserve water since at least the turn of the millennium, experts say.

For example, the city worked hard to fix leaks in the pipes that distribute water across the city. Leaky pipes are not a trivial matter — on average around the world, leaky pipes account for between 30 and 40 percent of a city’s lost water, Shafiqul Islam, an expert on water management at Tufts University, tells me. Cape Town has reduced the amount of water it loses through leaks to about half of that. And in 2015 — just three years ago — Cape Town even won a prestigious international award for its water conservation policies.

But 2015 also marked the beginning of a devastating three-year drought unlike anything the city had seen in more than a century. The drought exposed a key problem in the city’s water supply: its near-total reliance on rainwater. Unlike many other cities, which can draw their water supplies from various sources like underground aquifers or through desalination plants, Cape Town gets more than 99 percent of its water supply from dams that rely on rain.

Cape Town’s government thought its dams were big enough to deal with a drought — but they weren’t designed to deal with a once-in-a-century type of drought. While they were completely full just a few years ago, the dams now stand at about a quarter capacity.

There’s also a political dimension to the crisis. Cape Town and the province it’s in, the Western Cape, are governed by a party called the Democratic Alliance. But the national government (and every other provincial government in the country) is run by another party, the African National Congress (ANC).

Analysts say that partisan differences helped lay the foundation for Cape Town’s sluggish response to the drought in its early stages, and made it harder for the local and national government to form a united front once the water shortage became evident.

William Saunderson-Meyer, a South African journalist, points out that the national government had a clear incentive to drag its feet in helping the city get enough water: It may stand to benefit politically from a botched response to the shortage.

“Many ANC politicians would love to see the liberal ruling Democratic Alliance tarnished by failure in the Cape, perhaps opening the way to the ANC recapturing the province in 2019,” he writes at Reuters.

The flat-footed policy response to the drought has made the crisis even larger than it would’ve been otherwise.

Warding off Day Zero will require a lot of collaboration — and luck

Day Zero is not inevitable. It is possible that Cape Town’s population can collectively reduce its water usage quickly enough to prevent water levels in the city’s dams from dropping so low that water needs to be cut off.

Day Zero is supposed to kick in when they the dam levels drop to 13.5 percent. Theoretically, it’s possible that water levels won’t hit that point. In early February the projected date for Day Zero was moved from mid-April to May, and then later in the month to July, because of a decline in water usage. That first postponement was due to a decrease in usage from the agricultural sector in the province surrounding Cape Town, and the second one appears to be the result of a reduction in urban usage — how much water people use at homes and business in the city.

Bur urban usage has been pretty unpredictable in recent months, and fines for excessive usage haven’t been a particularly effective deterrent.

In January, the government said that no individual should be using more than 87 liters (23 gallons) of water a day, but a majority of the city’s residents went ahead and did so anyway.

“Despite our urging for months, 60 percent of Capetonians are callously using more than 87 liters per day,” Cape Town Mayor Patricia de Lille said during a press briefing on January 18. “It is quite unbelievable that a majority of people do not seem to care and are sending all of us headlong towards Day Zero.”

This month, Cape Town’s government has called for residents limit their water use even more — to 50 liters a day. The fines have increased as well, particularly for people who are using far too much water.

Cape Town residents not only need to collectively decide to start complying with the city’s usage restrictions, they need to do it until the city gets its long-awaited winter rains. According to Kevin Winter, an urban water management expert at the University of Cape Town, the city has seen its winter rains come later and later in the year over the past decade. While in the 1970s, the rains reliably started around April, recent patterns suggest that this year, substantial rain is more likely to come around July.

But if the current water restrictions don’t work and Day Zero does happen, things could get dicey in Cape Town, fast.

Day Zero could cause chaos in Cape Town

Day Zero is going to pose some big logistical challenges. Each of the water collection points will serve roughly 20,000 residents, many of whom will have to trek out to the sites daily.

South African police and military forces will be deployed to guard collection points, but with such small amounts of water provided at such a limited number of sites across the city, things could get rough. “The government’s first and foremost priority is going to be to try to quell anarchy,” says Patrick Reed, an expert on sustainable water management at Cornell University.

While wealthy residents are already installing private water tanks in their homes, lower-income residents don’t have any obvious solution for getting any more than their tiny daily allotment. And for the very poor who may live far from a distribution point and lack access to reliable transportation, just fetching that water is a challenge.

People would have to risk missing work or making less money just to be able to ensure they could get water to their homes.

Reed sums up the dilemma: “Would you be willing to get fired to get your water?”

Shafiqul Islam, the expert on water management at Tufts University, says that while it’s hard to predict outbreaks of violence in crises like this, the conditions in Cape Town are a natural tinderbox.

“Will it happen? We do not know. Is it likely to happen? Yes,” Islam says.

For more on Day Zero and the crisis in Cape Town, listen to the February 22 episode of Today, Explained.