In a key—but potentially temporary—victory for environmentalists and Indigenous communities, a federal judge has halted construction on the Keystone XL pipeline.

The pipeline is planned to run 1179 miles with the purpose of connecting Canada’s tar sands crude oil with refineries on the Texas Gulf Coast. It is owned by TransCanada, the same company whose Keystone pipeline spilled 210,000 gallons of oil in a field in South Dakota last November. It would run from Alberta, Canada, through Nebraska.

The judge, Brian Morris of the U.S. District Court in Montana, said President Trump’s State Department ignored crucial issues of climate change in order to further the president’s goal of letting the pipeline be built. In doing so, the administration ran afoul of the Administrative Procedure Act, which requires “reasoned” explanations for government decisions, particularly when they represent reversals of well-studied actions.

There has been opposition to the pipeline since its inception. Activists argue it would damage the climate via oil extraction, destroying trees and energy consumption that would increase greenhouse gas emissions. The pipeline is also a threat to Indigenous groups. In September, two Native American communities, the Rosebud Sioux Tribe and Fort Belknap Indian Community,sued the Trump administration for not adhering to historical treaty boundaries. In addition, the pipeline’s route could damage water systems and sacred Indigenous lands, environmentalists assert.

The judge’s decision is essentially, to quote The Washington Post, “a do-over.” It does not permanently stop the pipeline, but requires that the administration conduct a thorough review of potential negative impacts related to climate change, cultural resources and endangered species. Says The Post:

In a 54-page opinion, Morris hit the administration with a familiar charge, that it disregarded facts, facts established by experts during the Obama administration about “climate-related impacts” from Keystone XL. The Trump administration claimed, with no supporting information, that those impacts “would prove inconsequential,” wrote Morris. The State Department “simply discarded prior factual findings related to climate change to support its course reversal.”

The White House has not released a statement about the judge’s ruling.

Doug Hayes, senior attorney for Sierra Club, said in a statement, “The Trump administration tried to force this dirty pipeline project on the American people, but they can’t ignore the threats it would pose to our clean water, our climate and our communities.”

Tom Goldtooth, executive director for the Indigenous Environmental Network hailed the decision as progress in an emailed statement:

This is a win for Lakota, the Oceti Sakowin and other Tribal Nations, for the water, and for the sacredness of Mother Earth. This decision vindicates what we have been saying all along: Trump’s approval of this pipeline was illegal, violated environmental laws and was based upon false facts. Our legal fight has been for the benefit of all life along the proposed route of this Canadian tar sands pipeline. This pipeline is the enemy of the people, the climate and life as we know it. It must be stopped. We will continue our prayers to take action to fight the Trump administration in defense of the sacred, to protect Indigenous rights, to defend our treaty territories and to advocate for the continuation of the next seven generations of life on Mother Earth free from fossil fuels.