Hurricane Sandy has immobilized New York City for two days, with mass transit shut down, power out in many parts of the city, and widespread flooding. At least 10 people in the city died as a result of the storm.

Yet it’s worth saying that it could have been much, much worse. For a lot of modern history, cities were dangerous places, prone to acts of God. “In the olden days, you would have had lots of fatalities,” New York Mayor Michael Bloomberg (founder and principal owner of Bloomberg LP) said on Monday.

Earthquakes and fires ravaged San Francisco and other American cities as late as the turn of the 20th century, and London has been defined by its great conflagrations.

Tsunamis, quakes, floods and hurricanes can still kill hundreds of thousands in a single event in the Third World.

Now, though, you’d be hard-pressed to find a safer place on earth than in the heart of a wealthy metropolis.

Nearly a century after industrialization, skyscrapers were thought to be too dangerous for earthquake-prone Tokyo. Yet they were allowed beginning in the 1960s, when scientists “demonstrated that skyscrapers, if properly constructed, were actually more structurally stable than the six-to-eight-story office buildings that then constituted Japan’s standard office blocks,” as R. Taggart Murphy wrote in the New Republic shortly after the 2011 quake.

Many worried that a fear of “the big one” hitting Tokyo would deter residents from climbing much higher in the world’s largest city. While prices in high-rises fell after the disaster, especially around Tokyo Bay, the panic was short-lived. Nearly a year after the quake, Philip Brasor and Masako Tsubuku wrote in the Japan Times:

“According to real-estate analysts, the earthquake convinced many commuters to move closer to their workplaces, so if another major one strikes they would be able to get home quickly and without the need for public transportation. And the waterfront is within 5 km of the central business district of the capital.”

Threats from the sea have also been reduced in large First-World cities, thanks to advances in engineering and coastal defense. The Dutch have been fending off the sea from their densely populated strip of land for 1,000 years, and finally tamed it in the 20th century with the Delta and Zuiderzee Works, which turned their saltwater sea into a freshwater lake.

At a seminar at New York University’s Polytechnic Institute to study flood barriers in New York City, Brian Colle of Stony Brook University predicted in 2009 that episodes such as this week’s record-setting floods at the Battery in Lower Manhattan would become more common.

New York City doesn’t have much protection against storm surges, but for a few billion dollars, it could build defenses blocking the entrances to New York’s Upper or Lower Bays, according to presenters at the conference.

New York’s large taxpaying population packed onto a small amount of land makes such a plan feasible. Protecting entire coastlines such as the New Jersey shore, however, is probably not. Japan has a massive system of seawalls flanking much of its coast, but the defenses in its coastal towns were overwhelmed in last year’s tsunami.

Seawalls aren’t the only protection against natural disasters that cities can afford but outlying areas can’t.

Burying power lines is usually prohibitively expensive outside of dense neighborhoods, and city dwellers usually don’t have to wait as long as their suburban counterparts for streets to be plowed after snowstorms. Running water continues during power outages for those who live in towns with sewer systems, whereas those that rely on pumps are out of luck.

If climate scientists are correct and sea levels continue to rise and extreme weather becomes more common, cities will probably continue to find ways to protect themselves from natural disasters.

(Stephen Smith is a Brooklyn-based contributor to Bloomberg View. He writes on land use and public transportation.)