Opponents of the long-stalled Keystone XL oil pipeline asked a federal court on Friday to declare that Donald Trump acted illegally when he issued a new permit for the project in a bid to get around an earlier court ruling.

In November, US district judge Brian Morris ruled that the Trump administration did not fully consider potential oil spills and other impacts when it approved the pipeline in 2017.

Mr Trump's new permit, issued last week, is intended to circumvent that ruling and kick-start the proposal to ship crude oil from the tar sands of western Canada to US refineries.

White House officials have said the presidential permit is immune from court review. But legal experts say that is an open question, and the case could further test the limits of Mr Trump's use of presidential power to get his way.

Unlike previous orders from Mr Trump involving immigration and other matters, his action on Keystone XL came after a court already had weighed in and blocked the administration's plans.

Trump's inner circle: Meet the members of the US president's cabinet Show all 20 1 /20 Trump's inner circle: Meet the members of the US president's cabinet Trump's inner circle: Meet the members of the US president's cabinet Donald Trump's Cabinet Donald Trump's Cabinet is one the richest in American history, filled with billionaires, conservatives and several career politicians. AFP/Getty Trump's inner circle: Meet the members of the US president's cabinet Mike Pence US Vice President Mike Pence has defended Donald Trump throughout his presidency while walking a fine line to avoid any public involvement in major scandals. AFP/Getty Trump's inner circle: Meet the members of the US president's cabinet Mike Pompeo Secretary of State Mike Pompeo replaced Donald Trump's previous appointment to the post, Rex Tillerson, and has led talks with North Korea in establishing high-profile summits between the president and Kim Jong Un. Getty Trump's inner circle: Meet the members of the US president's cabinet Wilbur Ross Secretary of Commerce Wibur Ross raised controversy when he was accused of falsely claiming to have sold stock in a bank and violated a government ethics agreement. AFP/Getty Trump's inner circle: Meet the members of the US president's cabinet Robert Lighthizer US Trade Representative Robert Lighthizer has been a fixture in Donald Trump's ongoing trade spat with China. AFP/Getty Trump's inner circle: Meet the members of the US president's cabinet William Barr Attorney General William Barr replaced Jeff Sessions as the nation's top cop in early 2019 and has refused to commit to recusing himself from the Russia probe despite an unsolicited memo he sent to the Justice Department decrying the investigation. EPA Trump's inner circle: Meet the members of the US president's cabinet Rick Perry Energy Secretary Rick Perry has held his post throughout Donald Trump's presidency despite previously undermining the need for the agency he now leads in past public statements. Ken Shipp / United States Department of Energy Trump's inner circle: Meet the members of the US president's cabinet Betsy DeVos Education Secretary Betsy DeVos has also held her post throughout the presidency, despite major backlash to her apparent undermining of the nationwide public school system and advocacy for charter programmes. Getty Trump's inner circle: Meet the members of the US president's cabinet Steven Mnuchin Treasury Secretary Steven Mnuchin has faced numerous controversies throughout his tenure as the head of Treasury, including costing taxpayers at least a million dollars in travel expenses. AP Trump's inner circle: Meet the members of the US president's cabinet Robert Wilkie Veterans Affairs secretary Robert Wilkie was appointed after Donald Trump's White House doctor Ronny Jackson withdrew over allegations he provided prescription drugs to patients without prescriptions. AFP/Getty Trump's inner circle: Meet the members of the US president's cabinet David Bernhardt Secretary of the Interior David Bernhardt took office in January 2019 after the resignation of Ryan Zinke after previously serving as Zinke's deputy. Before taking office Bernhardt worked for many years as a solicitor for the Department of the Interior. Tami Heilemann / United States Department of the Interior Trump's inner circle: Meet the members of the US president's cabinet Elaine Chao Transportation Secretary Elaine Chao has held her post throughout the presidency and has mostly avoided controversy, despite a report claiming her office has been in frequent coordination with her husband's, Mitch McConnell. AFP/Getty Trump's inner circle: Meet the members of the US president's cabinet Kevin McAleenan Acting Secretary of Homeland Security Kevin McAleenan took over from Kirstjen Nielsen after she resigned in April 2019. He previously worked as the executive director of the executive director of the Office of Anti Terrorism in the Customs and Border Protection agency United States Customs and Border Protection Trump's inner circle: Meet the members of the US president's cabinet Ben Carson Secretary of Housing and Urban Development Ben Carson was appointed shortly after Donald Trump took office and raised controversy over an exorbitant furnishing bill for his office. Reuters Trump's inner circle: Meet the members of the US president's cabinet Gina Haspel CIA Director Gina Haspel was appointed in 2018 and faced backlash surrounding her oversight of Guantanamo Bay. Getty Trump's inner circle: Meet the members of the US president's cabinet Dan Coats Director of National Intelligence Dan Coats could be the next person to leave Donald Trump's administration over his refuting the president's claims surrounding ISIS. Reuters Trump's inner circle: Meet the members of the US president's cabinet Sonny Perdue Agriculture Secretary Sonny Perdue has been dogged by ethics questions throughout his tenure and faced controversy when emails showed the agency appeared willing to eagerly work with lobbyists under his leadership. Reuters Trump's inner circle: Meet the members of the US president's cabinet Alex Azar Health and Human Services Secretary Alex Azar is a former pharmaceutical lobbyist and former drug company executive. Getty Trump's inner circle: Meet the members of the US president's cabinet Mick Mulvaney Acting Chief of Staff and Office of Management and Budget Director Mick Mulvaney has described himself as one of the most conservative officials in the White House. EPA Trump's inner circle: Meet the members of the US president's cabinet Robert Wilkie Secretary of State for Veterans Affairs Robert Wilkie has spent his career on Capitol Hill serving in various roles in foreign affairs and defence. He holds the rank of Lieutenant Colonel in the US Air Force Reserve. Gene Russell / United States Department of Veterans Affairs

"This is somewhat dumbfounding, the idea that a president would claim he can just say, 'Never mind, I unilaterally call a do-over,"' said William Buzbee, a constitutional scholar and professor at Georgetown University Law Centre.

The pipeline proposed by Calgary-based TransCanada has become a flashpoint in the debate over fossil fuel use and climate change.

Opponents say burning crude from the tar sands of Western Canada would make climate change worse. The $8bn (£6.1bn) project's supporters say it would create thousands of jobs and could be operated safely.

The line would carry up to 830,000 barrels (35 million gallons) of crude daily along a 1,184-mile path from Canada to Nebraska.

Stephan Volker, an attorney for the environmental groups that filed the lawsuit on Friday, said Mr Trump was trying to "evade the rule of law" with the new permit.

"We have confidence that the federal courts—long the protectors of our civil liberties—will once again rise to the challenge and enforce the Constitution and the laws of this land," Mr Volker said.

The White House said in a statement that under the new order, federal officials would still conduct environmental reviews of the project.

However, officials said those would be carried out by agencies other than the State Department, which under Mr Morris' November order would have been forced to conduct another extensive study that could have taken months to complete.

Support free-thinking journalism and attend Independent events

TransCanada spokesperson Matthew John said the administration's action "clearly demonstrates to the courts that the permit is (the) product of presidential decision-making and should not be subject to additional environmental review."

Friday's lawsuit was filed in Mr Morris' court, meaning he is likely to get the first opportunity at addressing the legality of Mr Trump's new order. Judges typically do not respond favourably to perceived end runs around their decisions, said Carl Tobias with the University of Richmond law school.

Another legal expert, Kathryn Watts at the University of Washington, said it is unclear where the case will lead. Mr Trump's permit wades into "uncharted, unsettled" legal territory, she said.

The pipeline's route passes through the ancestral homelands of the Rosebud Sioux in central South Dakota and the Gros Ventre and Assiniboine Tribes in Montana.

Earlier this week, a court granted the tribes' request to intervene in an appeal of Mr Morris' November ruling that was filed by TransCanada. That case is pending before the 9th US Circuit Court of Appeals.

Tribal officials contend a spill from the line could damage a South Dakota water supply system that serves more than 51,000 people including on the Rosebud, Pine Ridge and Lower Brule Indian Reservations.

An existing TransCanada pipeline, also called Keystone, suffered a 2017 spill that released almost 10,000 barrels (407,000 gallons) of oil near Amherst, South Dakota.