As fatal floods washed away homes in parts of Germany and Belgium this summer, the team that manages Vienna’s flood defense knew they had about two days before the deluge reached the city.

The section of the Danube River that runs through the Austrian capital swelled to dangerously high levels. Within three hours on July 17, Austria’s meteorological service recorded more rainfall in Vienna than ever before.

And yet the flood defense unit wasn’t worried. They lifted the sluice gates of the New Danube and channeled some of the floodwater into this man-made side channel, allowing the river’s excess water, debris and tree branches to rush in. Swimming, boating and kayaking were temporarily banned. With the lower banks of Danube Island inundated, the restaurants and bars there remained closed. Everything had gone as planned.

“I think it’s fair to say that Vienna has the best flood protection in the world,” said Wilfried Fellinger, the engineer who leads the flood defense team.

Across Europe, the catastrophic and deadly July flooding left river communities worried whether their defense systems will suffice as climate change causes more-extreme weather events. Already, the global population at risk of flooding has risen by as much as a quarter, according to a new analysis led by researchers at the University of Arizona. By the end of this decade, millions of people who believe their homes are safe will find that they no longer are.

But the Viennese won’t be among them, Fellinger said. Statistically speaking, the flood defense he helped build in the 1980s would protect the city even from a 10,000-year flood. “It’s unique,” he said. Experts say it’s also a bold and visionary example that emphasizes the sweeping approaches many cities will have to take to protect themselves from increasingly common flooding.

In Vienna, planners used soil excavated from the river channel — essentially a waste product — to raise an island about 13 miles long, roughly the length of Manhattan, and 800 feet wide, with bike and hiking trails zigzagging through meadows and forests and past ponds and a couple of nudist beaches. Moored along its bank is a “school ship,” attended by nearly 1,000 students in grades 5 to 12.

“When Vienna takes the top spots in ‘most livable city’ rankings, then Danube Island as a leisure and recreational area is a big part of that,” said Andreas Voigt, a professor of urban planning at Vienna’s University of Technology.

The project, Voigt said, also allowed communities on the left bank of the Danube, commonly referred to as “Transdanubia,” to sprawl and develop into Vienna’s two largest districts. Where cows once grazed in flood zones, one-fifth of the city’s 2 million residents have now settled around the city’s tallest high-rises, including one of the United Nations’ four international headquarters.

What’s striking, too — and perhaps a lesson for today’s decision-makers — is that politicking took a back seat, said 91-year-old Reinhard Breit, who led urban planning in Vienna when the new flood defense projects were discussed.

“It was an open-ended process where the best ideas won, and not based on partisanship,” Breit said.

The first time Vienna tried to tame the Danube and mitigate flooding was in the 1870s. At a cost of $400 million in today’s money, the team that had just completed the Suez Canal channeled the river’s branches into a single course and fortified it with dikes as tall as a seven-story building. It was a mammoth undertaking — and yet it wasn’t bold enough.

The dikes burst not long after World War II, while American, French, British and Russian troops were still stationed in the city. Vienna flooded. For weeks, residents lived in emergency encampments while major roads and buildings were inundated with floodwater.

“It became clear to us that very tough measures would be necessary to really protect Vienna from flooding,” Breit said.

Looking into historical records, experts and officials found that the city’s worst flooding occurred in 1501. Based on that and other facts, the city government determined that a discharge channel would need to absorb up to 14,000 cubic meters of water per second from the river — roughly enough to fill 22,000 Olympic-size swimming pools each hour.

Even for a river the size of the Danube, “that’s huge,” said Hayley Fowler, a professor of Climate Change Impacts at the Newcastle University School of Engineering in England. When bursting dams and flash floods forced thousands of Central Europeans to flee their homes in 2013 in the worst flooding in centuries, Vienna remained unscathed. The discharge channel still had a quarter of its capacity to go.

Initially, the material that had to be excavated for the channel was to be “deposited somewhere behind the Iron Curtain,” Voigt said. Then planners floated the idea of using it to raise an artificial island. “Many wanted to build parking lots or apartment buildings on it, to refinance the construction costs,” said Breit, who supported keeping it as a green space.

Either way, the “spaghetti island” was ridiculed by tabloids as well as Vienna’s conservative party, which torpedoed the project. The socialist party, however, pushed on, and ended a coalition with the conservatives in 1973, partly because of the island. Construction began around that time, and lasted until 1988.

“Almost instantly, Danube Island became part of the Viennese,” said Breit, who went on to teach urban planning at Berlin’s Institute of Technology. With striped beach umbrellas, the Viennese staked their claim to the recreational area even before grass had grown on the embankments.

On sunny days, tens of thousands of people now flock to the area, according to city data.

“You really feel like you’re in nature, even though you’re pretty much in the middle of the city,” said Lena Köppler, a 22-year-old theater student who spent a recent Saturday swimming past swans, kayaks and stand-up paddlers. As for most Viennese, she said, the recent flooding was a brief reminder that the channel and island aren’t just leisure and entertainment venues; they are their guardians, too.

When delegations from countries such as Sweden, Russia, South Korea, China, Serbia and Slovenia come to learn from Vienna’s example, they are impressed, Fellinger said, but most raise the prohibitive costs of compensating property owners to make room for similar projects.

Another issue, Fowler said, “is knowing how big these [flooding] events can get, and what we are planning for.” Flood defense projects are generally based on the most recent catastrophe, or evaluations for flooding that, statistically, occurs once a century, she said.

Climate change, however, has made “hundred-year floods” much more common. “Now, you might have two in one decade,” said Igor Liska, an expert at the International Commission for the Protection of the Danube River, formed by the 14 countries that make the river basin the most international in the world.

Although Vienna might be an exception, Liska and Fowler said that river communities will simply have to live with flooding.

“In the past decades we thought we could protect people 100 percent by building high-enough dikes,” Liska said. “But now there is a new concept of living with the floods.”

The main goal is to create much larger areas where rainwater can be retained, and to give rivers more space to meander whenever possible.

From time to time, however, the weather extremes brought by climate change will still prove too much to handle, even for the largest retention areas. With torrential rains like those that caused the Rhine River to flood this summer, Liska said, “it is almost impossible to do anything. So then you have to try to minimize adverse impact.”

Raising public awareness — urging people to move out of flood zones or keep their ground floors clear of valuables — can mitigate the impact, he said.

Just like the bold flood defense Vienna conceived in the 1960s, today’s solutions could create opportunities for greener cities and more livable spaces.

One option is to turn urban areas into “sponge cities,” where sealed surfaces like sidewalks or rooftops are covered with greenery that helps absorb rainwater, said Lamia Messari-Becker, a civil engineering professor at the University of Siegen in Germany and adviser to the German government.

“Even if big channels can retain river flooding, if it rains too much, you still have the issue of the sewers being overcome,” Messari-Becker said, “so what we really have to do is make sure that rainwater can seep into the ground as quickly as possible.”

Fellinger said climate change is making the 10,000-year flood the city planned for more and more likely.

“It’ll come sooner,” he said, standing between the computers controlling the sluice gates and an old cathode ray tube TV set. Even then, he said, Danube Island wouldn’t be submerged.

For the Danube’s flood control, Fellinger said, “there’s nothing to improve. We just need to retain what we have.”