A Montana federal court judge blocked the Keystone XL oil pipeline from crossing bodies of water pending further federal permitting on Wednesday. On Thursday, the same judge heard arguments in additional lawsuits seeking to halt the pipeline's construction.

The Wednesday ruling by U.S. District Court Judge Brian Morris revoked a key U.S. Army Corps of Engineers water-crossing permit that a coalition of environmental groups said was granted in violation of environmental laws.

Construction of Canadian company TC Energy's long-delayed pipeline began earlier this month with a 1.2-mile border-crossing section of the pipeline on remote eastern Montana's frontier with Canada.

While some sections of the pipeline, including the border crossing, are unaffected by the ruling, the project can't be completed without the revoked water-crossing permit. Keystone XL has to cross more than 700 bodies of water over the course of its 1,200 miles traverse from the Alberta oil sands to a bitumen refinery hub in Nebraska. One of those water bodies is the Missouri River in Montana.

Morris' ruling is another reversal of fortune for TC Energy, whose Keystone XL project was spiked by the Obama administration before being resurrected by President Donald Trump soon after he entered office in 2017. A previous lawsuit by the same environmental groups resulted in a construction ban courtesy of a Morris decision in 2018, but last year Trump issued executive orders rewriting how oil pipelines are permitted, effectively overruling the courts and giving TC Energy the OK to begin construction.

"This ruling proves, once again, that we are a nation of laws no matter how many times powerful forces seek to undermine bedrock American legal protections," said Dena Hoff, a member of plaintiff Northern Plains Resource Council, in a press release.

Trump's executive orders and the border crossing were among the issues in court Thursday, as Morris oversaw a separate hearing concerning two more lawsuits brought against the pipeline by the Fort Belknap Indian Community and Rosebud Sioux Tribe, and the Indigenous Environmental Network and North Coast Rivers Alliance, respectively.

According to the tribes, the Trump administration is obligated to honor 19th century treaties requiring the federal government to protect the tribes from "depredation." Tribal attorney Matthew Campbell said the threat posed to the tribes by both pipeline construction and the coronavirus pandemic - which has stoked fears that out-of-state pipeline workers might spread the virus and overwhelm the sparsely populated region's medical resources - present such depredation.

"The president has a responsibility to protect the tribes," he said.

Campbell said the treaties also require tribal consent for projects like pipelines to cross tribal land, which the U.S. government and TC Energy did not seek when planning Keystone XL.

Though Keystone XL is not slated to cross the Fort Belknap or Rosebud Sioux reservations, it does cross off-reservation tribal land held in trust by the U.S. Department of the Interior. The trust process was created to return land to tribes after the government took reservation land.

Campbell said that the treaties require tribal consent for actions, including Keystone XL, which would affect mineral rights on trust lands.

Campbell also touched on arguments shared by plaintiffs in the second lawsuit that Trump's re-permitting of Keystone XL last year violated the Commerce Clause of the U.S. Constitution.

According to Indigenous Environmental Network and North Coast Rivers Alliance attorney Stephan Volker, the Commerce Clause gives Congress sole power to regulate foreign trade such as foreign pipelines entering the country. Volker said that while Congress has long acquiesced to the executive branch taking the lead on pipeline certification, with various presidents modifying that process, Trump's executive order re-certifying Keystone XL was incompatible with the will of Congress.

Representing the federal government, U.S. Department of Justice attorney Marissa Piropato said Trump's permit isn't solely an issue of commerce, but of foreign affairs and national security as well, over which the president exercises sole discretion.

Piropato said Trump's permit addresses only the border crossing, not the entire pipeline route, and that since no water bodies within the area of the border crossing flow into the Missouri River, the risk of the pipeline spilling oil into the Missouri River is "pure speculation." She said the court couldn't stop Trump from fulfilling his official duties.

Luther Hajek, also representing the federal government, said the tribes haven't shown any evidence of harm, and that the case should be dismissed.

TC Energy is digging a trench on tribal trust lands for a pipeline, not for mining, so mineral rights don't come into play, he said.

According to Hajek, the tribes' claim presumes the United States is obligated to file trespass claims against TC Energy on behalf of the tribes. Hajek said even if TC Energy were mining, the tribes couldn't compel the U.S. government to act.

Furthermore, Hajek said, prior court rulings on tribal treaties have established that the United States' duty to defend the tribes against depredation applies only to current tribal lands - that is, reservations - and not to trust lands.

That argument was echoed by attorney Peter Whitfield, representing TC Energy, who has intervened in both cases on the side of the federal government. Whitfield also said Keystone XL does not count as mining, and that "this pipeline is designed not to spill."

"That's always what they say about every single pipeline, and yet we do have spills," Campbell said during rebuttal. Campbell also accused the defendants of failing to address one of the several relevant treaties that does support a mineral rights argument, and said that, in effect, Trump's border-crossing permit green-lights the entire project, not just the 1.2 mile border crossing.

Volker agreed that the plain language of the permit shows it applies to the whole pipeline, not just the border crossing.

He also said the defendants must not understand that water flows downhill, as a creek in the vicinity of the border crossing eventually flows into the Missouri River.

In his closing remarks, Volker said permits have never been issued unilaterally, as Trump's was, and warned that the nation's founders included the Commerce Clause and other separations of powers in the Constitution after observing the danger of "unlimited executive power" in the form of King George III.

Thursday's four-hour hearing in Great Falls federal court was conducted via remote video teleconference, and was plagued by technical issues. Around the hearing's halfway mark, Morris noted that 147 people were listening to the proceedings via telephone. At one point, the microphone of the court stenographer, who was working remotely, picked up a barking dog.

Morris thanked everyone for their patience, and said he will issue an order in due course.