With the World Bank's support, a $120 million project was approved in 2012 to help spare the city's fading Art Deco center and makeshift slums from rising waters. An 11-kilometer (seven-mile) system of drainage canals and water retention basins now snakes from the beach deep into boggy neighborhoods.
It meant "the end of suffering of a whole population," Mayor Daviz Simango declared as the project's first phase was completed last year. Then "God changed his plan and brought a cyclone," Simango now says.
The storm that struck on March 14 brought a whole new level of pain to Beira, with images of destruction to chill any seaside nation already fearing for its survival. "We were really well prepared for disasters like flooding," Simango told The Associated Press, pausing from his work directing the disaster response in one of the city's poorest neighborhoods, Munhava.
The new system worked perfectly when there was flooding two months ago, said the mayor, a civil engineer who at times personally oversaw its construction. Residents told him they no longer needed to sleep on their tables.
The cyclone was a different story. Packing winds of some 240 kilometers (150 miles) an hour, the storm ripped apart structures built to withstand less than half that intensity. "This cyclone destroyed everything we built for more than 100 years."
It was painful watching the cyclone veer toward Beira, said World Bank staffers involved in the project who kept in touch with people on the ground until the storm severed power and communications. With Idai, "suddenly we have a cyclone category 4 hitting, and it's very vulnerable," Michel Matera, a senior urban specialist with the World Bank, told the AP. "Yes, we were doing the right thing but it was not enough."
Long and narrow with a 2,400-kilometer (1,500-mile) Indian Ocean coastline, Mozambique is on the frontline of fighting climate change in Africa, where most nations have little infrastructure and funding to cope. Rapidly growing coastal cities like Beira are especially at risk.
The mayor called it unjust that African nations face some of the toughest challenges while contributing little to global warming. People in rich, industrialized nations produce much of the carbon dioxide and other gases that are warming the planet by burning the most coal, diesel, gasoline and jet fuel.
But while Simango believes the international community should help African nations, he stressed the continent's leaders must do their part to fight graft and not pocket the aid. "Sometimes we get money, resources but the corruption kills us," he said. "We must be more prepared as leaders, doing our best to use every cent to save lives."
Ordinary Mozambicans may not be familiar with the science behind climate change. But the Beira residents who pick their way through inundated streets, and the longtime fishermen who keenly watch the sea and sky, have noticed changes.
They note that local temperatures that once topped out at around 34 degrees Celsius (93 degrees Fahrenheit) now reach a sweltering 40 degrees Celsius (104 degrees Fahrenheit). That warming air can hold more moisture, experts say, meaning the potential for heavier rains .
For fisherman Nueve Savimbi, who stood with a bamboo fishing pole where Beira's new concrete drainage system meets the sea, it took the raging storm to open his eyes. "I've heard about climate change but didn't believe it until I saw the cyclone," he said. "Without this (drainage system), there would be flooding here. But there is still work to do. Channels like this should be built elsewhere."
Without extensive study, scientists cannot directly link a single weather event like Cyclone Idai to the changing climate, but global warming is responsible for more intense and more frequent extreme weather events, as well as droughts, floods and fires.
Mozambique ranks third among African nations in vulnerability to weather-related disasters, behind Somalia and Madagascar, and studies say climate change will make those threats more intense and unpredictable , according to the Global Facility for Disaster Reduction and Recovery, a World Bank-managed grant-funding partnership.
For residents recovering from the cyclone and those watching with alarm from afar — the storm hit as Africa Climate week unfolded across the continent in Ghana, another vulnerable coastal nation — the time has come to treat climate change as an emergency.
"Cyclone Idai was an uncommonly fierce and prolonged storm, yet another alarm bell about the dangers of climate change, especially in vulnerable, at-risk countries," U.N. Secretary-General Antonio Guterres said on Tuesday. "Such events are becoming more frequent, more severe and devastating and more widespread, and this will only get worse if we do not act now."
The world must deliver on the $100 billion pledged as part of the Paris climate agreement to help Mozambique and other developing nations build climate resilience, Guterres said. Countries around the world, rich and poor, had more than $2.2 trillion in economic losses from climate-related disasters between 1998 and 2017, the U.N. Office for Disaster Risk Reduction said in October.
In Beira, it is too early to calculate the cyclone's toll, whether in economic losses or even in lives. Some residents say they believe an exodus will begin, with people leaving the port city for higher, safer places. Others argue that eventually, there will be nowhere else to go.
"Other districts have flooding," said Julia Castigo, who stood on the beach watching survivors arrive by boat from the badly hit district of Buzi. "The flooding will find us." Another onlooker, Paolo Fernando Machata said a major flood nearly two decades ago didn't reach his village, but this one swallowed it. He spent three days stranded in flood waters, he said, pointing to his bandaged, swollen feet.
"I'd never heard about climate change," he said. "What I know is, things are changing. If cyclones like this keep happening, we will lose this town and the people in it, and our society." Still, that society has already shown flashes of resilience amid the destruction. Beira's seaside bars have reopened, pulsing with generator-powered music. Muddy markets bustle again, and shop owners have cleared away broken glass and reopened. Some classes have resumed as children in bright uniforms now share school buildings with displaced people.
From the international relief operations base at Beira's airport, Sebastian Rhodes Stampa, deputy director of the United Nations humanitarian operation, was frank. "I think the world realizes we haven't done enough about climate change," he told journalists. Disasters "are getting worse around the world. All of us must be prepared."
For Beira's mayor, the time to take climate change seriously has come. Standing in a still-sodden neighborhood, he urged U.S. President Donald Trump to come to Mozambique and see for himself. "I think he is living in another world," Simango said of Trump's expressions of doubt about global warming. "I've seen by my own eyes the rising of the sea level. I've seen by my own eyes people suffering. I've seen flooding. Climate change is a reality. Climate change is bringing us trouble."
Follow Africa news at https://twitter.com/AP_Africa