Famous for its role in America’s war for independence, this city is now fighting the rising seas. Boston is raising streets, building berms and even requiring that new high-rise condominium developments on its harbor acquire “aqua fences” — portable metal barriers that can be dragged to the street and anchored to the pavement to deflect incoming waves. Mayor Martin J. Walsh (D) has vowed to spend more than $30 million a year, equal to 10 percent of Boston’s five-year capital budget, to defend the city from a watery future that is expected because of climate change.

“People talk about a managed retreat” for waterfront cities, said Boston’s chief of environment, energy and open space, Christopher Cook, as he looked out on the city skyline from a popular waterside park across the harbor. “Where do we retreat to?” Although Florida, Louisiana and the Carolinas are frequently associated with flooding, Boston was ranked the world’s eighth most vulnerable to floods among 136 coastal cities by a 2013 study produced by the Organization for Economic Cooperation and Development.

The sea that surrounds Boston crept up nine inches in the 20th century and is advancing ever faster toward the heart of the city.