The U.S. military's biggest base on American soil has begun drawing nearly half of its power from renewable energy, days after President Donald Trump's decision to pull out of a global agreement to fight climate change.

Fort Hood, in Texas, has shifted away from fossil fuels to wind- and solar-generated energy in order to shield the base from its dependence on outside sources, a spokesman said.

"We need to be autonomous. If the unfortunate thing happened and we were under attack or someone attacked our power grid, you'd certainly want Fort Hood to be able to respond," Chris Haug, a spokesman for Fort Hood, said in a phone interview.

The project brings the Army base, home to 36,500 active-duty personnel and some 6,000 buildings, in line with the Department of Defense's decade-long effort to convert its fossil fuel-hungry operations to renewable power.

It comes in the wake of Trump's decision last week to withdraw the United States from a landmark global agreement to fight climate change, the Paris accord, a move that drew condemnation from world leaders and heads of industry.

The project is already fully operational. Its 63,000 solar panels, located on the base's grounds, and 21 off-base wind turbines provide a total of some 65 megawatts of power, according to an Army statement.

Burning fossil fuel generates greenhouse gases that are blamed by scientists for warming the planet.

The Paris accord aims to reduce such emissions, including by encouraging a shift to clean energy.

Fort Hood's new solar field and wind farm will result in savings of more than $100 million over some 30 years, the Army said.

Over the last decade, the U.S. military and intelligence officials have developed a broad agreement about the security threats that climate change presents, in part by threatening to cause natural disasters in densely populated coastal areas, damage American military bases worldwide and open up new natural resources to global competition.

The number of military renewable energy projects nearly tripled to 1,390 between 2011 and 2015, a Reuters analysis of Department of Defense data previously showed.

The Defense Logistics Agency (DLA), a Department of Defense agency assisting the Army in its renewable-energy shift, is also working with the U.S. Air Force on long-term renewable energy projects, a DLA spokeswoman told the Thomson Reuters Foundation.