President Obama will permanently ban offshore drilling in most of the U.S.-controlled Arctic as well as off much of the Atlantic Seaboard, the White House announced Thursday.

The move—billed as an effort to conserve important marine species and protect against oil spills—represents a last-ditch measure by Obama to strengthen his environmental legacy in advance of President-elect Donald Trump taking office in January. Trump has promised to boost the oil and gas industry by “scrapping” many Obama-era environmental regulations.

The White House maneuver relies on a little-used 1953 law that gives the President authority to block indefinitely oil and gas drilling in some waters controlled by the U.S. federal government. The move may be impossible to undo—at least in the short term. The law does not include a provision for a future president to undo the decision and no president has ever tried such a move. But energy interests could challenge that in courts or a Republican-dominated Congress could revise the original law.

Blocking drilling in the Arctic represents a dramatic shift for Obama, who has seen domestic oil production rise during his time in office and who as recently as last year cited pursuing fossil fuels in the Arctic as part of a comprehensive energy strategy. Last month, Obama reversed course on his support for Arctic drilling, putting in place a five-year offshore drilling ban for much of the region beginning in 2017. The permanent ban announced Tuesday will extend that measure indefinitely.

Read More: Dying Coral Reefs Impact Environment and Economy

Tuesday’s announcement came in tandem with a similar action from Canada that bans drilling in the Arctic indefinitely—though subject to review every five years. Canada’s measure does not affect existing oil and gas drilling leases.

Obama’s move drew immediate praise from environmental groups concerned that Trump will undo much of the regulation aimed at addressing climate change issued in the last eight years. “Millions of people around the world will be grateful to President Obama for permanently protecting much of the Arctic and the Atlantic coasts from catastrophic oil exploration and development,” says Travis Nichols, a Greenpeace spokesperson. “Decisions like these are crucial.”

Read More: Meet the President Trying to Save His Island Nation From Climate Change

The move protects most of the Chukchi and Beaufort Seas off the north coast of Alaska. In the Atlantic, the move will protect a number of scattered underwater canyons in coastal waters that range from Maryland to Massachusetts.

But even without the ban, it’s unclear how eager energy companies would be to drill in the Arctic and offshore waters, given the high costs of exploration and the low cost of oil in today’s market. Royal Dutch Shell abandoned a drilling project last year for those reasons after spending $7 billion on the effort. A senior White House official cited some of these economic considerations as reason to block Arctic drilling.

“The economics of pursing oil and gas in this region are just not there,” said a senior administration official before the announcement, “There’s no viable strategy to this on a timeline that’s responsible for our country.”

The move will almost certainly draw criticism from Republicans in Congress who say that drilling in the Arctic would create jobs and support the economy. “Arctic development is one of the best ways to create jobs, generate revenues and refill the Trans-Alaska Pipeline,” said Alaska GOP senator Sen. Lisa Murkowski in response to Obama’s five-year ban last month. “Why the president is willing to send all of those benefits overseas is beyond explanation.”