The Great Falls Tribune reported TransCanada was getting ready to start building the pipeline in northern Montana when the judge issued the order.

Back in 2015, then-President Barack Obama rejected the project due to environmental concerns. But shortly after taking office, President Donald Trump reversed that decision and approved a federal permit for the pipeline.

In his 54-page opinion, U.S. District Court Judge Brian Morris said that when approving the permit, the Trump administration "simply disregarded" climate change concerns brought up by his predecessor. Morris argued that simply stating those "climate-related impacts ... would prove inconsequential" doesn't count as a "reasoned explanation" to justify the 2017 decision.

Morris said if officials want to continue building the pipeline, they must go back to the drawing board and come up with a better explanation for why they made the switch.

As of early Friday morning, both TransCanada and the Trump administration had not commented on the ruling.