THE southern tip of Queens was the worst hit part of New York. Waves tore apart boardwalks, and swept through streets, causing floods more than five feet (1.6 metres) deep. Cars floated onto lawns. As the waters retreated, they left behind urban sand-dunes. A fire, started by the storm, destroyed more than 110 homes in Breezy Point. Across the city, at least 22 people lost their lives during the night of October 29th-30th, out of at least 50 Americans known to have been killed by the storm. At least 70 people were killed by it in the Caribbean.

Hurricane Sandy, at 900 miles across the largest tropical storm ever recorded in the Atlantic, hit New York and New Jersey especially hard, though damage was done in much of America’s north-east. That the loss of life was not far greater (a hurricane that hit New England in 1938 killed up to 800 people) owed much to the emergency response of the authorities, with Governor Andrew Cuomo of New York, Governor Chris Christie of New Jersey and New York City’s mayor Michael Bloomberg to the fore. They were ably supported by the Federal Emergency Management Agency (FEMA), partially offsetting its ignominy in New Orleans in 2005. Yet the storm exposed vulnerabilities in the infrastructure of the self-styled capital of the world, which will need to be addressed before an even stronger hurricane blows its way, as sooner or later it will.

In New York, the Hudson and East River breached their banks, flooding Manhattan streets and the Ground Zero memorial, and filling the Brooklyn-Battery tunnel, which connects Manhattan to 2.5m people in Brooklyn, with 43m gallons of water. The Midtown tunnel, which connects Queens and Manhattan, was built to withstand flooding, yet it flooded, too, as did significant parts of the subway, which as one wag put it, got a “once-in-a-century clean”. Runways at JFK and La Guardia airports were submerged. More than 15,000 flights were cancelled. Amtrak trains were cancelled, too. An explosion in a water-damaged transformer left much of lower Manhattan without electric power, probably for several days. When New York University hospital’s backup generator failed, patients had to be evacuated in the middle of the hurricane, including babies born prematurely who rely on respirators.

Much of the financial district was wet (time for another Wall Street bail-out, said some) and in the dark, except for the headquarters of Goldman Sachs, which thanks to a generator remained a beacon of light for global capitalism. Ninety percent of homes in Long Island lost power, too.

In the 1990s Governor Cuomo was head of HUD, the federal housing department, in which role he encountered many disasters, but nothing to match this. New York City’s damage surpassed that of Hurricane Andrew, Midwest floods and earthquakes in California. “What I saw,” he said “were some of the worst conditions I have seen.”

New Jersey was in even worse shape. The seaside towns along the famous Jersey Shore were devastated; the popular Seaside Heights resort was practically wiped out, the amusement park on its pier torn to pieces. As The Economist went to press, Mantoloking, another resort town, was still burning. Atlantic City’s famous boardwalk is partly destroyed, the casino signs left as the sole providers of light to the city. Many beaches have suffered dreadful erosion. The surging storm tide tossed railway carriages onto the New Jersey turnpike, the state’s main artery.

All along the East Coast there was flooding and loss of power. Fire Island, a popular resort off Long Island, was said to be unrecognisable. Connecticut was hit hard, too. Some 360,000 people were evacuated from its flooded coastal towns. In Maryland the Ocean City pier collapsed into the sea. Even Cleveland, Ohio, almost 460 miles inland from New York City, was battered by 60mph winds and driving rain. Twenty-foot waves from Lake Erie crashed onto the city’s main commuter artery, forcing its closure.

The full economic cost of Sandy will not be known for years. The personal property claims will be significant. Infrastructure all over the region is destroyed. Early estimates by IHS Global Insight indicate that insured infrastructure damages will be around $10 billion, about half the total cost of repair. This estimate will probably prove too low.

East-coast oil refineries were idled and nuclear plants were powered down. The New York Stock Exchange remained shut for two days, its longest weather-caused closure since 1888. The subway, and in particular the light rail that connects New York with New Jersey beneath the Hudson, will not be back to normal for many days. IHS has early estimates of total economic losses of $30 billion-$50 billion, about 1-1.7% of gross regional product (GRP) in the states affected. In comparison, Hurricane Katrina caused about $120 billion in damages, 9.6% of GRP for the impacted states. However, reconstruction should serve as a mini-stimulus for the regional economy, much as it did in Florida following Hurricane Andrew in 1992.

President Obama quickly made FEMA funds available. Too quickly, for political reasons, complained Michael Brown, who disastrously headed the agency during Katrina. This was if nothing else a reminder that a natural disaster does not always help a president look presidential: George W. Bush notoriously praised “Brownie” for doing “a heck of a job”. But Sandy was the sort of October surprise that showed Mr Obama at his best, and will help him in next week’s election. Mr Christie, a popular, straight-talking Republican who has been campaigning for Mitt Romney, had only good things to say about Mr Obama’s response to the storm, at one point explaining that “I don’t give a damn about election day.” While Mr Christie and Mr Obama rode together in Marine One, Mr Romney was left to help put together parcels for hurricane relief—in the swing state of Ohio. FEMA’s response has made his crusade against big government harder to sustain in the final days of the campaign.

Two winters ago, Mr Bloomberg was embarrassed by being out of New York when a blizzard struck. Since then he has made sure to get ahead of pending bad weather, with last year’s Hurricane Irene evacuations proving a drier-than-predicted run for Sandy. Yet, as with New Orleans, there have long been warnings of the dangers posed by a severe storm, and recommendations to invest in better defences against surging tides have gone unimplemented. In 2011 a City Hall report on the waterfront, “Vision 2020”, strongly urged building lots of dykes and seawalls, and flood-proofing buildings.

Other reports have recommended putting expensive movable barriers along the East River and the harbour to prevent flooding, as London did on the Thames three decades ago. Mr Cuomo wants levees built in lower Manhattan, and Mr Christie wants to rebuild his shore to protect the beaches and the towns. He accepts, however, that iconic things have washed away. Still, as he said the day after the storm, “as long as sorrow doesn’t replace resilience, we’ll be just fine.”