ON MARCH 13th 1989 a surge of energy from the sun, from a “coronal mass ejection”, had a startling impact on Canada. Within 92 seconds, the resulting geomagnetic storm took down Quebec’s electricity grid for nine hours. It could have been worse. On July 23rd 2012 particles from a much larger solar ejection blew across the orbital path of Earth, missing it by days. Had it hit America, the resulting geomagnetic storm would have destroyed perhaps a quarter of high-voltage transformers, according to Storm Analysis Consultants in Duluth, Minnesota. Future geomagnetic storms are inevitable.

And that is not the only threat to the grid. A transformer-wrecking electromagnetic pulse (EMP) would be produced by a nuclear bomb, designed to maximise its yield of gamma rays, if detonated high up, be it tethered to a big cluster of weather balloons or carried on a satellite or missile. A midrange missile tested by North Korea on April 29th 2017 exploded 71 kilometres (44 miles) up, well above the 40km or so needed to generate an EMP.

Imagine a nuclear blast occurring somewhere above eastern Nebraska. Radiating outwards, the EMP fries electronics in southern Canada and almost all of the United States save Alaska and Hawaii, both safe below the horizon. It permanently damages the grid’s multimillion-dollar high-voltage transformers. Many are old (their average age is about 40). Some burst into flame, further damaging substations.

America runs on roughly 2,500 large transformers, most with unique designs. But only 500 or so can be built per year around the world. It typically takes a year or more to receive an ordered transformer, and that is when cranes work and lorries and locomotives can be fuelled up. Some transformers exceed 400 tonnes.

After the surge, telecom switches and internet routers are dead. Air-traffic control is down. Within a day, some shoppers in supermarkets turn to looting (many, unable to use credit and debit cards, cannot pay even if they wanted to). After two days, market shelves are bare. On the third day, backup diesel generators begin to sputter out. Though fuel cannot be pumped, siphoning from vehicles, authorised by martial law, keeps most prisons, police stations and hospitals running for another week.

With many troops overseas or tasked with deterring land grabs from opportunist foreign powers, there is only one American “peacekeeper” soldier for every 360 or so civilians. Pillaging accelerates. This leads many with needed skills to stay home to protect their families. Many of the rock climbers who help overwhelmed fire departments free tens of thousands from lifts begin to give up on day four despite the heart-wrenching banging that continues to echo through some elevator shafts.

Utilities can neither treat nor pump water or sewage. Raids on homes thought to have water become frequent and often bloody. Militias soon form to defend or seize control of swimming pools and other water sources. Streams and shovelled-out pits provide water in some areas, but sooner or later rain sweeps in faeces-ridden mud. Deaths from cholera and other diseases multiply.

As relief ships arrive, food, water filters and fuel are offloaded by hand amid chaos, but demand cannot be met even in port cities, much less inland. Where food can be grown without pumped irrigation, rural militias cluster into “aggie alliances” not keen to share with the hordes streaming out of cities. Some aggie alliances hole up in newly abandoned prisons, the better to defend scavenged crops and farm animals. The value of cash collapses along with faith in government.

The death rate picks up. Eventually, months later, about three quarters of the benighted area has power for at least ten hours a day. It would have been worse had 41 countries not dismantled transformers for reassembly in North America. (The most generous donors have to accept rolling blackouts.) Martial law ends six months after the original energy surge. Roughly 350,000 Canadians and 7m Americans have died.

A similar nightmare could happen in any rich country—grids outside America are vulnerable too. Such scenarios necessarily dip into “uncharted territory for an industrialised society”, as Thomas Popik, head of the Foundation for Resilient Societies, a think-tank in New Hampshire, puts it. But shorter blackouts suggest that things can get bad fast. Just three hours after Chile’s grid-collapsing earthquake on February 27th 2010, even relatively wealthy people began looting stuff they did not need. With electricity gone, normal rules had suddenly vanished and “out of control” emotions took over, says Roberto Machiavello, then rear-admiral and top martial-law official in Chile’s Concepción area.

Without soldiers at hospitals, Admiral Machiavello says, doctors would have stayed at home. Less than a week after Hurricane Katrina struck New Orleans in 2005, many police officers opted to protect their families rather than work. Chris Ipsen, spokesman for the Emergency Management Department of Los Angeles, estimates that, with the grid down, Angelenos would be foodless in less than ten days. In poor areas, he reckons, groups would quickly form and say, “Hey, let’s go over to the mansions in Bel Air.”

Insurance, anyone?

In the aftermath of Haiti’s earthquake in January 2010, cholera alone killed at least 10,000. Jacques Boncy, head of Haiti’s National Laboratory of Public Health, reckons that, in three months of blackout in America, faecal contamination of water would kill several million. That might be optimistic. The EMP Commission, an expert group set up by America’s Congress to study the threat, reckoned in 2008 that the first year of societal breakdown could finish off two-thirds of Americans.

A country’s electricity grid can be knocked out in other ways. One is cyber-attack. Hackers cut power to 230,000 Ukrainians in December 2015—but only for hours. Long-term damage from cyber-assaults is unlikely, says Kenneth Geers, a security expert who studied the attack.

What about terrorism? Shooting up transformers at just nine critical substations could bring down America’s grid for months, according to an analysis performed in 2013 by the Department of Energy’s Federal Energy Regulatory Commission (FERC), says its then-chairman, Jon Wellinghoff. Others think more transformers would need to be taken out. At any rate, information on which substations are critical is secret. In 2013 gunmen knocked out 17 of 21 transformers at a substation in San Jose. It was not a critical one.