(AP)  A federal judge in Alaska has ruled an executive order by President Donald Trump allowing offshore oil drilling of tens of millions of acres in the Arctic Ocean is “unlawful and invalid.”

The ruling Friday from U.S. District Judge Sharon Gleason means a drilling ban for much of the Arctic Ocean off of Alaska will go back into effect.

Gleason said Trump exceeded his authority when he reversed a ban on offshore drilling in vast parts of the Arctic Ocean and dozens of canyons in the Atlantic Ocean.

Gleason threw out Trump’s executive order that overturned the ban implemented by President Barack Obama.

Presidents have the power under a federal law to remove certain lands from development but cannot revoke those removals, Gleason said.

A Department of Justice spokesman, Jeremy Edwards, declined comment Saturday.

“The wording of President Obama’s 2015 and 2016 withdrawals indicates that he intended them to extend indefinitely, and therefore be revocable only by an act of Congress,” said Gleason, who was nominated to the bench by Obama.

The drilling bans were a key part of Obama’s environmental legacy. Trump reversed them in April 2017.

On April 28, 2017, Trump issued an executive order reversing three memoranda and one executive order in 2015 and 2016 by Obama withdrawing about 125 million acres of the Arctic Ocean from oil leasing. The Obama order also prevented drilling in certain parts of the Atlantic Ocean.

That action by the Obama administration prompted strong criticism from some Alaska politicians and oil companies that wanted to drill there.

Ten environmental groups, including Greenpeace, the League of Conservation Voters, the Sierra Club and The Wilderness Society, filed suit to block Trump’s executive order. Defending the order were the Trump administration, the American Petroleum Institute and the state of Alaska.