President Donald Trump’s decision to withdraw from the Paris climate agreement has come under attack from elected officials across the United States and the CEOs of some of America's biggest companies. But it’s also likely to cause anger and unease at a surprising place: the Pentagon.

That’s because some of the Defense Department’s top officials have already expressed their fears that a warming planet poses serious threats to the US. Defense Secretary James Mattis told the Senate Armed Services Committee that climate change would make the world less stable and require the entire government to curb it. Obama’s last defense chief, Ashton Carter, said that climate change was a top strategic challenge for the US on par with terrorism and North Korea’s nuclear program.

And back in 2015, the Pentagon released a report that showed it knew climate change was, and would continue to be, a problem. “DoD recognizes the reality of climate change and the significant risk it poses to US interests globally,” it stated.

The comments and report highlight a little-known fact about the military. Many people see it as a politically conservative, hidebound institution, but it’s actually one of the most aggressive parts of the US government when it comes to acknowledging the threat posed by climate change and taking concrete steps to fight it.

That doesn’t come from any sort of touchy-feely belief about the importance of being a good shepherd of the natural world. Far from it: the Pentagon’s top military and civilian officials believe that climate change poses a direct threat to US national security and to the stability of the world at large, making their job harder and more dangerous both at home and abroad.

Here’s what they fear: important bases in the United States may soon be underwater, while other American facilities in warm places abroad will only continue to get hotter. More countries will be hit by droughts and famines, destabilizing central governments and paving the way for the rise of dictators or the dissolution of countries into lawless regions controlled by warring militias. Either scenario could give terror groups like ISIS new safe havens.

More broadly, defense experts worry if the US does not keep its commitments to the international order, other nations might not keep their commitments to the US.

It’s a dark picture, and one that the president either doesn’t see, or doesn’t care enough to understand. Either way, the decision to leave the Paris agreement will make the US military’s job much harder even as it confronts threats ranging from North Korea to Syria to the escalating terror war in Yemen.

Climate change threatens the US military at home and abroad

For the Pentagon, the impact of global warming would be immediate — and significant. According to a report from the National Academy of Sciences, a three-foot rise in sea levels will threaten the operations of more than 128 US military sites.

The Navy, and especially it’s facility in Norfolk, Virginia — the country’s largest naval base — would likely be severely impacted. Already, the base is dealing with “nuisance flooding” — that is, when water around the base area makes it harder to get in and out of the installation.

At the base’s docks, sailors are already experiencing higher waves, which can make it more difficult for them to even make it onto their ships. But that would be a luxury compared to the complete flooding of a base, which is likely to be a sad reality in the not too distant future.

It’s very possible that by the year 2100, many of the at-risk bases could be submerged, according to the report from the National Academy of Sciences. That would be a disaster, as part of America’s strength is the plethora of bases that allows the military to station and train troops, prepare new equipment, and, if necessary, defend the homeland.

“Our ships can’t dock if the pier is under water,” Sherri Goodman, a former top Pentagon environmental security official, said in an interview.

Basically, America’s security declines as sea levels rise.

So it’s looking like the job of troops at home could be made harder in the years to come if temperatures continue to rise. But what about those abroad?

The military is deployed in around 800 military bases in more than 70 countries and territories around the world. The US has large and growing contingents in nations — like Iraq, Syria, and Afghanistan — where electricity is spotty and summertime temperatures already routinely rise well above 100 degrees. All of those countries will get even hotter in years to come.

Back in 2011, the Pentagon was already spending $20 billion per year for air conditioning in Iraq and Afghanistan because of the broiling heat. ($20 billion is more than NASA’s annual budget.) Part of that cost includes the fuel to keep the air conditioning running.

But fuel didn’t just magically appear. Troops were required to deliver it to the bases that needed it to stay cool. Unfortunately, those convoys became targets, and nearly 1,000 troops died delivering fuel in really dangerous areas. It’s therefore morbidly safe to say that excessive heat has already cost many US service members their lives.

The heat won’t just affect how the US operates abroad. It also changes the security dynamics in other countries.

As the weather gets warmer, droughts and famines will create more failed states, former Air Force Secretary Deborah Lee James said in an interview. Failed states are natural breeding grounds for terrorists who, down the line, could attack America.

So, to recap: US military installations are starting to flood, and could be inundated by the end of the century. Places where troops already serve — like in the Middle East — will continue to get hotter, which will cost the US more blood and treasure. And, that increased heat will make certain areas less stable, which could lead to an increase in terrorism — the very trend the US is working so hard to reverse.

All of that is undoubtedly scary. But defense leaders also worry about what leaving the Paris accord means for other agreements the US has with other countries.

One of those worried people is Sean O’Keefe, the former Navy secretary and NASA administrator. He thinks the US will have trouble gaining the trust of other nations when we make deals because of Trump’s willingness to abandon one that his predecessor had formally agreed to.

“Our behavior abrogating this agreement now implies that every understanding will only be as good as the willingness to enforce them,” he told me in an interview. “That's a tough task made tougher when we signal that good faith doesn't matter.”

So, while Trump may feel he has helped make America great again by leaving the Paris deal, he’s gone about it in a funny way: by refusing to do what is necessary to stop a threat to the US military that many in the Pentagon itself see as inevitable.

Correction: A previous version of this article attributed the report about the threatened 128 military installations to the Union of Concerned Scientists, not the National Academy of Sciences. Also, those installations would be threatened by sea-level rise, not made inoperable, as originally stated.