The U.S. Court of Appeals Wednesday vacated a District Court judge’s July ruling to shut down the Dakota Access Pipeline and empty its contents by August 5.

In general, the appeals court ruled U.S. District Judge James Boasberg did not follow established legal tests before issuing a shutdown order in a national environmental policy case.

At the same time, the U.S. Court of Appeals rejected a request by the US Army Corps of Engineers to also vacate the Boasberg’s decision to vacate an easment that would allow the Dakota Access Pipeline to cross the Missouri River at Lake Oahe. Boasberg also ordered the Corps to prepare an environmental impact statement regarding the easement for the pipeline.

The appeals court ruled, “At this juncture, appellants [US Army Corps of Engineers] have failed to make a strong showing of likely success on their claims that the district court erred in directing the Corps to prepare an environmental impact statement.”

On July 6, U.S. District Judge James Boasberg sided with the Standing Rock Sioux Tribe and ordered the Dakota Access pipeline to shut down until more environmental review is done.

In a 24-page order, Boasberg wrote that he was “mindful of the disruption such a shutdown will cause,” but said he had concluded that the pipeline must be shut down.

“Clear precedent favoring vacatur during such a remand coupled with the seriousness of the Corps’ deficiencies outweighs the negative effects of halting the oil flow for the thirteen months that the Corps believes the creation of an EIS will take,” Boasberg wrote.

Boasberg had ordered both parties to submit briefs on whether the pipeline should continue operating during the new environmental review.

The pipeline was the subject of months of protests, sometimes violent, during its construction near the Standing Rock Sioux Reservation that straddles the North Dakota-South Dakota border. The Standing Rock tribe presses litigation against the pipeline even after it began carrying oil from North Dakota across South Dakota and Iowa and to a shipping point in Illinois in June 2017.

The $3.8 billion, 1,172-mile (1,886 kilometer) underground pipeline crosses beneath the Missouri River, just north of the reservation. The tribe draws its water from the river and fears pollution. Texas-based Energy Transfer insisted the pipeline is safe.

This is a developing story.