This story was originally published by High Country News and has been republished here with permission from Climate Desk.

After a slew of climate-friendly ballot initiatives went down in flames on Election Day in Arizona, Colorado, and Washington, greens needed something to cheer them up. Days later, the good news came in the form of a possibly deal-killing setback to a controversial oil pipeline: A federal judge sent the Keystone XL proposal back to the drawing board because it failed to comply with federal environmental regulations.

First proposed in 2008, the 1,200-mile pipeline would carry as much as 830,000 barrels of heavy crude oil per day from Alberta oil sands to Steele City, Nebraska, en route to Gulf Coast refineries. In 2015, President Barack Obama denied a permit for the pipeline, citing climate concerns, but in 2017, President Donald Trump reversed the denial, allowing the project to move forward.

The Indigenous Environmental Network then sued the Trump administration, claiming that it erred by relying on an outdated analysis of the pipeline’s environmental impacts. On Nov. 8, U.S. District Court Judge Brian Morris ruled in favor of the plaintiffs on several issues, vacated the 2017 approval decision, and ordered the State Department to supplement the environmental impact statement, completed in 2014. That additional analysis must include a “hard look” at the effects of current oil prices, potential increases in greenhouse gas emissions, possible damage to cultural resources, and new data on oil spills.

A major sticking point in the 2014 impact statement is its prediction for how the pipeline would contribute to climate change. In short, the analysis concludes that although burning the oil carried by the pipeline would emit about 168 million tons of carbon each year, constructing the pipeline would result in no new greenhouse gas emissions.

“Even when reversing a policy after an election, an agency may not simply discard prior factual findings without a reasoned explanation.” — Judge Brian Morris

The conclusion assumes that even without the pipeline, the same amount of oil would get to market by some other means. That’s because as long as oil prices remain at or above $100 per barrel, oil producers are willing to spend the extra cash to ship their bitumen—the waxy crude that comes from oil sands—via rail. When the analysis was completed, the price of oil was closing in on $150 per barrel.

But oil prices did not stay high. Just months after the impact statement was published, global prices crashed, falling below $40 per barrel and plunging most oil-sands-mining operations into the red. That radically altered the climate impact calculus of the pipeline. When oil sinks below $75 per barrel or so, it no longer makes economic sense to pay to move it by train, meaning production will fall. The Keystone XL, however, would decrease shipping costs, helping to keep the oil sands viable. That would lead to an increase in production and a concurrent rise in greenhouse gas emissions.

Furthermore, independent analyses have found that Keystone XL could also increase emissions by displacing other, less carbon-intensive forms of crude and by adding enough oil to the global market to lower prices, thereby boosting consumption—and emissions. Both scenarios were discounted in the original impact statement.

It was during the price slump that Obama put the kibosh on the pipeline. Today, domestic prices have bounced back up to about $60 per barrel, still far below the level at which the pipeline would result in no net increase of greenhouse gas emissions.

Also missing from the 2014 analysis is a full accounting of potential impacts to cultural resources along the pipeline’s route. The analysis identified hundreds of cultural sites but also said that over 1,000 acres remained unsurveyed. Apparently, the surveys had not been completed when the 2017 approval was made.

And then there are the potential oil spills. The 2014 analysis predicted that the new pipeline would not spill more than once every 10 years. Data from federal pipeline regulators, however, suggest this is a lowball estimate. The Dakota Access Pipeline and its southern counterpart, ETCO, for example, have experienced 11 spills since they went into operation in 2017. Furthermore, the National Academy of Sciences in 2015 published a study finding that spilled bitumen “starts to turn into a heavy, viscous, sediment-laden residue that cannot easily be recovered using traditional response techniques.”

All of this information must be taken into account and addressed before the project can be permitted, Judge Morris said in his recent ruling. That could take years. The Trump administration has indicated that it will appeal the ruling.

Morris directed his harshest scolding toward the Trump administration for reversing its predecessor’s policy and dismissing the environmental concerns without adequate reasoning. In so doing, he could have been referring to any number of Trump’s regulatory rollbacks. “Even when reversing a policy after an election, an agency may not simply discard prior factual findings without a reasoned explanation,” Morris wrote. “An agency cannot simply disregard contrary or inconvenient factual determinations that it made in the past, any more than it can ignore inconvenient facts when it writes on a blank slate.”