(Bloomberg Law) — The Dakota Access pipeline must shut down by Aug. 5, a district court ruled Monday in a stunning defeat for the Trump administration and the oil industry.The decision, which shuts the pipeline during a court-ordered environmental review that’s expected to extend into 2021, is a momentous win for American Indian tribes that have opposed the Energy Transfer LP project for years. It comes just a day after Dominion Energy Inc. and Duke Energy Corp. scuttled another project, the Atlantic Coast natural gas pipeline, after years of legal delays.Environmentalists have increasingly used the courts to try to block additional investment in fossil fuel infrastructure while they push for a clean energy transition. Tribes, landowners, and other project opponents have also complained about local impacts from construction and potential spills on or near their land.The sophisticated legal onslaught has led to delays and disruptions for several other pipelines, including Keystone XL. But Monday’s court order, if upheld on appeal, marks the first time a major, in-service oil pipeline will be forced to shutter because of environmental concerns.Energy Transfer said it’s “immediately pursuing all available legal and administrative processes” to challenge the decision.‘Historic Day’The U.S. District Court for the District of Columbia said a crucial federal permit for Dakota Access fell too far short of National Environmental Policy Act requirements to allow the pipeline to continue operating while regulators conduct a broader analysis the court ordered in a previous decision.The ruling scraps a critical permit from the Army Corps of Engineers, and requires the pipeline to end its three-year run of delivering oil from North Dakota shale fields to an Illinois oil hub. Judge James E. Boasberg said Dakota Access must shut down the pipeline and empty it of oil by Aug. 5.“Today is a historic day for the Standing Rock Sioux Tribe and the many people who have supported us in the fight against the pipeline,” tribal Chairman Mike Faith said in a statement. “This pipeline should have never been built here. We told them that from the beginning.”Boasberg acknowledged that the ruling would cause major disruptions for Dakota Access and the North Dakota drillers that supply its oil.“Yet, given the seriousness of the Corps’ NEPA error, the impossibility of a simple fix, the fact that Dakota Access did assume much of its economic risk knowingly, and the potential harm each day the pipeline operates, the Court is forced to conclude that the flow of oil must cease,” he wrote, referring to the National Environmental Policy Act.Energy Transfer said it plans to immediately ask Boasberg to freeze the decision, and will head to the U.S. Court of Appeals if that request is denied.The company said it’s confident “that once the law and full record are fully considered Dakota Access Pipeline will not be shut down and that oil will continue to flow.”The Army Corps referred questions about the ruling to the Justice Department, which didn’t immediately respond to requests for comment, including on whether it intends to appeal the ruling. But Energy Secretary Dan Brouillette slammed the ruling, and said the Trump administration would continue promoting U.S. energy infrastructure.“It is disappointing that, once again, an energy infrastructure project that provides thousands of jobs and millions of dollars in economic revenue has been shut down by the well-funded environmental lobby, using our Nation’s court system to further their agenda,” he said in a statement.DisruptionsKatie Bays, co-founder of Washington-based Sandhill Strategy LLC, said the court ruling “is likely to be enormously disruptive.” The Army Corps’ 18-month timeline for addressing flaws in its environmental review makes Energy Transfer “vulnerable to a change in administration and a more draconian policy towards oil pipelines,” she said.ClearView Energy Partners analyst Christine Tezak said “there is a strong possibility that the new Biden Administration could decide to not reissue the authorizations now that the permits have been vacated.”The ruling will also fuel litigation against other projects, as it “just totally overturns that conventional wisdom” that courts will never force in-service pipelines to shut down, said Southern Methodist University law professor James W. Coleman.“There’s no legal rule that says you won’t shut down an existing pipeline but people felt like that was such a constant that they could count on it,” he said.Coleman assigned 50% odds to the prospect that the D.C. Circuit would stay the lower court’s decision. Some analysts speculated odds as low as 30%.The pro-pipeline GAIN Coalition argued that Monday’s decision jeopardizes energy security, and said it’s confident “common sense will prevail and this decision will be stayed or overturned.” The American Petroleum Institute called for permitting reform.“Our nation’s outdated and convoluted permitting rules are opening the door for a barrage of baseless, activist-led litigation, undermining American energy progress and denying local communities the environmental, employment and economic benefits modern pipelines provide,” the oil industry group said.Energy Transfer’s shares fell as much as 13.8% Monday for the biggest intraday drop since mid-March.Continental Resources Inc., the shale producer founded by Harold Hamm, another prominent Trump supporter, also fell on the decision, as did Hess Corp. Both companies have significant operations in the Bakken shale field, and a shutdown of Dakota Access will make it harder for them to pipe their crude out of the basin.Physical sweet crude prices in the U.S. rose slightly against oil futures on Monday, as the closing of the pipeline means less oil supply. However, prices for oil produced in North Dakota have come under pressure as the loss of the conduit would mean less interest from buyers.Years of OppositionBoasberg’s decision comes after four years of litigation from tribes opposed to Dakota Access’ route across Lake Oahe, a dammed section of the Missouri River just a half-mile from the Standing Rock Indian Reservation in the Dakotas.The Standing Rock Sioux, Cheyenne River Sioux, and others sued the Army Corps for approving the water crossing in 2016, saying it put tribal water supplies and cultural resources at risk.Their frustrations triggered an outpouring of support from fellow tribes, indigenous advocates, and environmentalists from across the country. Thousands of pipeline opponents camped out in North Dakota for months to show their opposition.The Obama administration responded by withholding a final permit and committing to a new consultation process, but President Donald Trump quickly put Dakota Access back on track after taking office in 2017.Kelcy Warren, the billionaire chief executive officer of Energy Transfer, has long been a Trump fan. He recently hosted a fundraiser for the president’s re-election campaign at his private Dallas home.“My God, this is going to be refreshing,” Warren told investors two days after Trump won the last election.Despite high-profile opposition to Dakota Access, including from celebrities and some of Warren’s favorite musicians, the Energy Transfer founder has stood by the project, going so far as to say he talks about Dakota Access “like I talk about my son” earlier this year.“I’m so proud of that project,” he said.Trouble in CourtBut the district court in Washington found flaws in the government’s pipeline approval process. Boasberg ordered the Army Corps to conduct additional environmental review in mid-2017, but allowed the pipeline to remain in service during that time.Earlier this year, the court again identified shortcomings in the Army Corps’ review, concluding that the agency didn’t fully consider expert disagreement over the risk of an oil spill in Lake Oahe. The Army Corps must do an in-depth environmental impact statement for Dakota Access, the judge said.Boasberg issued the opinion in March and ordered both sides to submit new briefs explaining whether the pipeline should shut down in light of the decision.The default consequence for an agency violation of the National Environmental Policy Act is invalidation of the permit at issue, but legal precedent allows courts to balance that outcome against other factors, including how disruptive nixing a permit would be, and how likely an agency is to support its original decision after additional analysis.The Army Corps has said it expects to finish the court-ordered analysis in mid-2021.The case is Standing Rock Sioux Tribe v. Army Corps of Engineers, D.D.C., No. 1:16-cv-01534, 7/6/20.—With assistance from Sheela Tobben (Bloomberg News).To contact the reporter on this story: Ellen M. Gilmer (Bloomberg Law) in Washington at firstname.lastname@example.org and Rachel Adams-Heard (Bloomberg News) in Houston at in Houston at email@example.comTo contact the editors responsible for this story: Gregory Henderson at firstname.lastname@example.org; Chuck McCutcheon at email@example.com; Anna Yukhananov at firstname.lastname@example.org(Adds comment from energy secretary in paragraph 13-14.)For more articles like this, please visit us at bloomberg.comSubscribe now to stay ahead with the most trusted business news source.©2020 Bloomberg L.P.