President Trump announced Thursday that the US will pull out of the Paris global climate pact — fulfilling a campaign promise but alarming other world leaders and even going against the wishes of fossil fuel giants like Exxon and BP.

“The United States will withdraw from the Paris climate accord but begin negotiations to re-enter either the Paris accord or an entirely new transaction in terms that are fair to the United States and its workers. So we’re getting out. We’ll see if we can make a deal. If we can’t, that’s fine,” Trump said to cheers during a ceremony in the Rose Garden in which he patted himself on the back for keeping his campaign promises.

“I was elected to represent the citizens of Pittsburgh, not Paris,” Trump added after detailing what he said the costs of remaining in the accord would be.

President Obama in a statement lamented the decision, saying that other nations would benefit at the expense of the US.

“The nations that remain in the Paris Agreement will be the nations that reap the benefits in jobs and industries created. I believe the United States of America should be at the front of the pack,” he said, adding that US cities, states and businesses would still work to reduce warming.

“Even in the absence of American leadership; even as this Administration joins a small handful of nations that reject the future; I’m confident that our states, cities, and businesses will step up and do even more to lead the way, and help protect for future generations the one planet we’ve got,” Obama said.

Pittsburgh Mayor Bill Peduto, a Democrat, also was not amused.

“As the Mayor of Pittsburgh, I can assure you that we will follow the guidelines of the Paris Agreement for our people, our economy & future,” he tweeted, also saying, “The people of Pittsburgh voted for Hillary Rodham Clinton — 80 percent.”

Supporters applauded the move.

“Predicting the future is notoriously difficult. Modeling is not an exact science,” said Sen. Rand Paul (R-Ky.).

White House talking points obtained earlier by the AP said the Paris accord was “a BAD deal for Americans” and that the president’s action would keep “his campaign promise to put American workers first.”

“The accord was negotiated poorly by the Obama Administration and signed out of desperation. The US is already leading the world in energy production and doesn’t need a bad deal that will harm American workers,” the notes read.

EPA Secretary Scott Pruitt and Trump adviser Steve Bannon, both climate change skeptics, pushed the president to withdraw, while Trump’s daughter Ivanka reportedly wanted her father to stay in the accord.

The White House had signaled that the move was likely, but Trump has been known to change his mind at the last minute on such major decisions.

Abandoning the pact was one of Trump’s principal campaign pledges, but America’s allies have expressed alarm about the likely consequences.

Trump’s decision reverses one of the Obama administration’s signature achievements, and means the US will join only Nicaragua — which didn’t think the treaty went far enough — and Syria as UN-member countries that aren’t aboard. Even China and Russia remain committed to the pact.

The US emits more carbon into the atmosphere than any country except China.

Abandoning the pact would isolate the US from international allies that spent years negotiating the 2015 agreement to fight global warming and pollution by reducing carbon emissions in nearly 200 nations.

While traveling abroad last week, Trump was repeatedly pressed to stay in the deal by European leaders and the pope.

American corporate leaders have also appealed to the businessman-turned-president to stay in the pact.

They include leaders of Apple, Google and Walmart. Even fossil fuel companies such as ExxonMobil, BP and Shell say the United States should abide by the deal.

In a Berlin speech, Chinese Premier Li Keqiang said that fighting climate change is a “global consensus” and an “international responsibility.”

“China in recent years has stayed true to its commitment,” Li said Wednesday.

Obama enacted the deal without US Senate ratification. A formal withdrawal would take years, experts say, a situation that led the president of the European Commission to speak dismissively of Trump on Wednesday.

Trump doesn’t “comprehensively understand” the terms of the accord, though European leaders tried to explain the process for withdrawing to him “in clear, simple sentences” during summit meetings last week, Jean-Claude Juncker said in Berlin.

“It looks like that attempt failed,” Juncker said.

With AP