(Montana Free Press) A Great Falls federal judge on Thursday blocked construction of the controversial Keystone XL oil pipeline, ruling the federal government did not adequately consider the potential environmental hazards the pipeline posed to the climate and communities along the proposed route.

In his 54-page ruling, Montana U.S. District Judge Brian Morris found the federal government violated the National Environmental Policy Act by failing to adequately address potential spills, the pipeline’s cumulative effects on greenhouse gases, its necessity based on oil prices, and its effect on cultural resources.

Morris vacated the U.S. Department of State’s 2017 decision to build Keystone XL until a new study is completed.

Billings-based Northern Plains Resource Council was one of the lead plaintiffs in the lawsuit.

“We’re thrilled with Judge Morris’s ruling today,” NPRC chairwoman Becky Mitchell said in a press release. “In essence, this decision sends TransCanada back to the drawing board.”

Representatives for TransCanada could not immediately be reached. A message to a representative from the Montana Petroleum Association was also not immediately returned late Thursday.

The Obama administration in 2015 nixed Keystone XL over concerns that the tar sands oil it would transport would void America’s commitment to the Paris Agreement on climate change. That decision was based on the state department’s 2014 environmental study.

The Trump administration in 2017 resurrected Keystone XL on the basis of the 2014 environmental study, a decision Morris said, “simply discarded prior factual findings related to climate change to support its course reversal.”

In response to the Trump administration’s decision, a coalition of environmental and indigenous rights groups sued the federal government in March 2017. Morris’s ruling presents a major victory for groups opposed to the pipeline.