WASHINGTON — As disaster costs keep rising nationwide, a troubling new debate has become urgent: If there’s not enough money to protect every coastal community from the effects of human-caused global warming, how should we decide which ones to save first?

After three years of brutal flooding and hurricanes in the United States, there is growing consensus among policymakers and scientists that coastal areas will require significant spending to ride out future storms and rising sea levels — not in decades, but now and in the very near future. There is also a growing realization that some communities, even sizable ones, will be left behind.

Want climate news in your inbox? Sign up here for Climate Fwd:, our email newsletter.

New research offers one way to look at the enormity of the cost as policymakers consider how to choose winners and losers in the race to adapt to climate change. By 2040, simply providing basic storm-surge protection in the form of sea walls for all coastal cities with more than 25,000 residents will require at least $42 billion , according to new estimates from the Center for Climate Integrity, an environmental advocacy group. Expanding the list to include communities smaller than 25,000 people would increase that cost to more than $400 billion.

“Once you get into it, you realize we’re just not going to protect a lot of these places,” said Richard Wiles , executive director of the group, which wants oil and gas companies to pay some of the cost of climate adaptation. “This is the next wave of climate denial — denying the costs that we’re all facing.”