Justice Department attorneys are due in U.S. District Court in Montana on Wednesday to defend the administration's March approval of the 1,179-mile pipeline - a lightning rod in the debate over what to do about climate change.
The TransCanada proposal would transport Canadian crude oil through Montana and South Dakota to Nebraska, where it would connect with an existing system of lines to carry oil to Gulf Coast refineries.
The Obama administration rejected the project before the proposal was revived in March by President Donald Trump, who said it would create jobs and lead to greater energy independence.
Conservation groups and Native American organizations that sued over the project argue that an environmental review completed in 2014 was inadequate. They've asked U.S. District Judge Brian Morris to revoke its permit.
FILE - President Donald Trump shows his signature on an executive order on the Keystone XL pipeline, Jan. 24, 2017, in the Oval Office of the White House.
Government attorneys said in their motion to throw out the case that Morris can't interfere because the Constitution gives Trump authority over matters of foreign affairs and national security.
'The remedy that plaintiffs seek - an injunction against the presidential permit - is not available because such an order would impermissibly infringe on the president's authority,' Justice Department attorney Bridget McNeil wrote.
The project's economics have shifted considerably since the pipeline was proposed in 2008, with low oil prices and the high cost of extracting Canadian crude from Alberta's oil sands now casting doubt on whether it would be profitable.
Opponents say those market changes undercut arguments from Keystone supporters that oil sands crude would get to consumers by another means if the pipeline was not built.
The opponents said the current market conditions should have been weighed by the State Department before it issued the permit.
'In a low oil market world, adding close to a million barrels a day of capacity out of the tar sands is a lifeline for that industry. You can't say it's going to find its way to market whether this pipeline is built,' said attorney Doug Hayes with the Sierra Club, one of the plaintiffs in the lawsuits.
A State Department spokeswoman said the agency does not comment on lawsuits.
A TransCanada executive in August raised doubts about Keystone's prospects and said the Calgary-based company would decide later this year about whether to start construction.
Company spokesman Matthew John said Tuesday that the project was in the national interests of the U.S. and Canada. He declined to address the lawsuits or the pipeline's economic prospects.
TransCanada last week canceled plans for a pipeline that would have carried crude from Alberta to New Brunswick on the Atlantic coast. The company cited regulatory delays and 'the associated cost implications' faced by its Energy East Pipeline proposal.
In the U.S., Keystone has faced heated opposition from landowners whose property would be crossed by the line and farmers who live downstream from river crossings.
Opponents planned a rally ahead of Wednesday's hearing in Great Falls to draw attention to their concerns.
Among the protesters will be Dena Hoff, who farms along the Yellowstone River near the small city of Glendive, Montana, 13 miles downstream of where Keystone XL would cross the waterway. Hoff worries about a repeat of a 2015 oil pipeline spill into the Yellowstone at the edge of her property that fouled Glendive's drinking water supply.
'They're talking about endangering one of the most historic, iconic and economically important rivers in this part of the country,' she said.
The Nebraska Public Service Commission must decide by Nov. 23 whether to give approval. South Dakota and Montana regulators have approved the project.