A federal judge has ordered that construction on the Keystone XL pipeline should be halted immediately - earning a rebuke from Donald Trump over a project that had been key to his economic programme.

The judge ruled that the government did not do the necessary environmental assessment before beginning construction. US District Court Judge Brian Morris wrote that a State Department environmental analysis of Keystone XL “fell short of a 'hard look'” at the cumulative effects of greenhouse gas emissions and the impact on Native American land resources.

The Keystone XL pipeline has been a matter of contention between the Trump administration and environmental groups, resulting in protests around the country. In 2016, protests over the pipeline even became a national movement among Native Americans.

Now, Judge Morris in Montana has declared that the project violates the Administrative Procedure Act (“APA”), the National Environmental Policy Act (“NEPA”), and the Endangered Species Act (“ESA”). Former analyses of the impact of the pipeline on the environment and wildlife had been “simply discarded,” the judge wrote. According to federal law, scientific analyses of environmental impact must be considered when construction projects like the pipeline occur.

Mr Trump approved the pipeline shortly after taking office and he called the decision by Judge Morris “a political decision" and a "disgrace".

The function of the 1,200-mile Keystone XL pipeline is to bring crude oil from Alberta, Canada to the United States. President Trump argued that the project would bring jobs to Americans and then appointed Scott Pruitt, a supporter of the pipeline, to run the Environmental Protection Agency before Mr Pruitt later left his post.

Support free-thinking journalism and attend Independent events

The plaintiffs in the lawsuit were the Indigenous Environmental Network, North Coast River Alliance, and North Plains Resource Council. The defendants were the United States Department of State et al, Transcanada Keystone Pipeline, and Transcanada corporation. Opponents to the pipeline include organisations concerned over climate change, land degradation, and the digging up of private land, including that which belongs to Native Americans.

“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,” said the Sierra Club.

The ruling does not mean that the Keystone XL Pipeline is cancelled. It means that the Trump administration needs to re-evaluate the environmental impact and ensure that they are following regulations before they proceed.