What do you do when the sea comes for your home, your school, your church?

You could try to hold back the water. Or you could raise your house. Or you could just leave.

An estimated 600 million people live directly on the world’s coastlines, among the most hazardous places to be in the era of climate change. According to scientific projections, oceans stand to rise by 1 to 4 feet by the end of the century, with projections of more ferocious storms and higher tides that could upend the lives of entire communities.

Many people face the risks right now. Two sprawling metropolitan areas offer a glimpse of the future. One rich, one poor, they sit on opposite sides of the Pacific Ocean: the San Francisco Bay Area (population 7 million) and metropolitan Manila in the Philippines (almost 14 million).

Their history, their wealth and the political and personal choices they make today will shape how they fare as the water inevitably comes to their doorsteps.

In both places, it turns out, how you face the rising sea depends mostly on the accident of your birth: whether you were born rich or poor, in a wealthy country or a struggling one; whether you have insurance; whether your property is worth millions or is little more than a tin roof.

And in both places, climate change has magnified years of shortsighted decisions. Manila allowed groundwater to be pumped out so fast that the land sagged and turned into a bowl just as the sea was rising. The Bay Area allowed people to build right at the water’s edge, putting homes, highways and even airports at risk of catastrophic flooding.

But people tend to hold on as the water rises around them. In some cases that’s because their properties are worth a lot — for now, at least — or because they have so little that they have nowhere else to go.

Now Manila and the Bay Area face tough choices. They could adapt to the rising tide, which could mean moving people out of harm’s way. Or they could try to force the water to adapt to their needs by raising their defenses. For leaders, politically tough decisions lie ahead. What do they save on the water’s edge, what do they forsake, and how do they re-imagine their coastal cities in an age of climate disruptions?

The Bay Area and metropolitan Manila are both big and growing, with a lot of people and things to protect on the coast. How they deal with their circumstances today may offer lessons, for better or worse, for coastal cities elsewhere.

“Are we going to decide by not deciding and wait for the water to reach our doorsteps?” asked Aaron Peskin, a member of the San Francisco board of supervisors.

“The biggest challenge is getting society to understand it, grapple with it, address it, plan for it, discuss the trade-offs.”

Rising water, sinking city

Desiree Alay-ay is in the thick of trade-offs.

Alay-ay, 30, grew up in a low-lying, flood-prone neighborhood on the northern fringe of Manila. It is not what she wants for her newborn baby. She wants to move and take her parents with her.

Climate change has exacerbated a longtime problem in Manila. Because of a proliferation of fish ponds and the rapid extraction of groundwater, the ground has been subsiding. As a result, since the early 1990s, sea levels have risen by as much as 2 to 2.7 inches a year, double the global average.

Storms repeatedly sweep away spindly-legged bamboo and tin houses on the water. People flee for a while, only to come back because they have nowhere better to go. In low-lying neighborhoods like Alay-ay’s, roads have been raised multiple times.

“Climate change doesn’t create its own impacts. It magnifies wrong policies,” said Renato Redentor Constantino, executive director of the Manila-based Institute for Climate and Sustainable Cities. “This is the case with sea level rise. A large part of metropolitan Manila is facing more water-related impacts because of decades of myopic, cross-eyed land use planning.”

More than 30 years ago, before Alay-ay was born, her parents, migrants from the countryside, built a small house in Malabon, the only neighborhood they could afford in Manila.

The water pooled up in the streets every rainy season. The city fought back by raising the road. So Alay-ay’s parents raised their house to stay above the road. They poured cement and sand on the floor four times in 30 years.

Everyone lived like this. One neighbor raised the floor so high that the original kitchen sink is now ankle-high. Another abandoned the house altogether; its roof is barely above street level now, and water hyacinths have taken over the rooms.

It was only after Alay-ay had a baby that she set her mind to getting out of Malabon.

She wanted her parents to come, too, so they could watch the baby while she and her husband went to work. But they had other plans. Leave the baby with us, her mother offered. But we’re not moving. This is our home.

Alay-ay’s dilemma is magnified manyfold in a megacity like Manila.

Millions of the city’s poorest live in hazardous, low-lying areas that are already lashed by tropical storms. Climate change is projected to make those storms even more intense and more frequent.

But leaving those areas can mean being even farther from where you make a living.

Forcing people to move away from the coast is not enough, said Antonia Yulo-Loyzaga, a member of the board of directors of the Manila Observatory, a research organization. They need to be able to find work nearby or an efficient public transportation system to get there. That doesn’t exist now; average commutes are two hours or more each way.

“You need some sort of rational, organized retreat from the coast,” she said. “There’s no option unless you want people to live in constant fear.”

A political lightning rod

A rising sea underscores the missteps of the past in the Bay Area, too.

The Pacific has risen 4 to 8 inches along the Northern California shore over the last century — and so, too, the San Francisco Bay, the ocean’s largest estuary in the Americas. Depending on the growth of greenhouse gas emissions, the Pacific could rise 2.4 to 3.4 feet by 2100, which is why the California Coastal Commission has encouraged city governments to start planning for the future — by fortifying their flood defenses, restoring wetlands or, in some instances, making people move.

“People’s properties and investments are at risk,” said Jack Ainsworth, head of the commission. Unlike Manila, Bay Area municipalities are wealthy. And many of them are already paying handsomely to fortify high-value coastal infrastructure at risk.

Voters in San Francisco have approved a $425 million bond measure to start fortifying a sea wall along the bay-front road, the Embarcadero. Along the road sits some of the city’s most expensive real estate; below it sits a subway line, a light-rail tunnel and part of the city’s sewage infrastructure. And the San Francisco airport, which sits on tidal marshlands, is getting a $587 million makeover to raise its sea wall.

Nowhere is the danger more starkly on display than in Pacifica, a suburb south of the city, where coastal bluffs are eroding so swiftly that city officials have already demolished some properties before they could fall into the water.

The soft, sandy bluffs have been eroding for thousands of years. Climate change is accelerating that process, though, said Charles Lester, a former Coastal Commission official who now directs the Ocean and Coastal Policy Center at the University of California, Santa Barbara. The tides are higher, and the waves are more frequently coming up to the foot of the bluffs.

On a gray Monday morning, Lester stood at the edge of the bluff on the north end of town on a walking path around an apartment complex called OceanAire. A sea wall had to be built — and then rebuilt after it failed. A pile of boulders sits at the bottom of the wall to stave off damage from the waves. All that armoring, as it’s known, has saved the apartment complex. But it has come with a public cost: The beach has narrowed. In some parts, there is no beach left.

That is the problem facing many Bay Area communities: How much do you armor the coast, what do you choose to save, and who will have to move? Managed retreat, as it’s called, has become a political lightning rod.

Money complicates matters in other ways: Property taxes are a key source of revenue. Forcing people to move away would punch holes in city budgets. And anyway, who would pay to buy out homeowners? In Pacifica, some single-family houses on the bluff are worth upward of $1 million.

Already, there’s been unmanaged retreat in Pacifica. Some sea walls crumbled, at one point endangering a row of apartments. The 52 tenants were entitled to zero compensation. They just had to move. The city spent $620,000 on demolition.