A federal judge in Alaska ruled on Friday that President Donald Trump "exceeded the president's authority" when he signed an executive order to allow offshore oil drilling in around 125 million acres of the Arctic Ocean, CNN reported.

U.S. District Court Judge Sharon Gleason's decision restores a ban on drilling in 98 percent of the U.S.-controlled Arctic Ocean, according to Earthjustice, which sued to stop Trump's order on behalf of several environmental groups and Alaska Native communities.

The ruling "shows that the president cannot just trample on the constitution to do the bidding of his cronies in the fossil fuel industry at the expense of our oceans, wildlife and climate," Earthjustice attorney Erik Grafe said in a statement reported by the Associated Press.

Former president Barack Obama had instituted the ban via three memoranda and one executive order, protecting much of the Arctic Ocean and parts of the Atlantic as well. In her ruling Friday, Gleason said that the Outer Continental Shelf Lands Act allows the president to withdraw lands from leasing, but not to reverse a previous withdrawal. That, she said, can only be done by Congress. "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," Gleason said, according to CNN. She said the executive order allowing drilling was therefore "unlawful and invalid." Obama had intended the bans to protect polar bears, walruses, ice seals and the Native Alaskan communities that depend on these animals. He also banned exploration in 5,937 square miles of canyons in the Atlantic to protect deep-water corals, migrating whales and other marine mammals and fish populations, the Associated Press reported. "This victory shows that no one, not even Trump, is above the law," League of Conservation Voters President Gene Karpinski said in a statement reported by CNN. "Offshore drilling and the associated threat of devastating oil spills puts coastal economies and ways of life at risk while worsening the consequences of climate change. President Trump wanted to erase all the environmental progress we've made, but we fought back and we won."