Environmentalists and Indigenous rights advocates celebrated on Thursday after a judge struck down the Canadian government's 2014 approval of a controversial pipeline project in a landmark ruling.

The court found (pdf) that the government had not done enough to consult with First Nations communities that would be impacted by the building of the Northern Gateway pipeline, approved under then-Prime Minister Stephen Harper.

The decision "confirms that the environmental assessment of major pipeline projects was badly eroded by the previous government's dismantling of environmental laws," said Barry Robinson, an attorney for the environmental law firm Ecojustice, which brought the case.

Caitlyn Vernon, a spokesperson for the Sierra Club, told CBC, "Today is a good day for the B.C. coast, climate and salmon rivers. By overturning federal approval of Northern Gateway, the courts have put yet another nail in the coffin of this pipeline and tankers project."

"First Nations, local communities, and environmental interests said 'no' to Enbridge 12 years ago when it first proposed the project. And now that 'no' has the backing of the courts," Robinson said.

The pipeline would have transported tar sands crude from Alberta to Kitimat, British Columbia. Opponents have long warned that it would expand the use of dangerous fossil fuels, delay the implementation of clean energy, and increase dangers faced by the environment and impacted communities, including possible violation of First Nations treaty rights.

Critics have also pointed out that Northern Gateway's parent company, Enbridge, has a history of environmental destruction, including a massive pipeline rupture that spilled close to one million gallons of crude oil into Michigan's Kalamazoo River and Talmadge Creek in 2010—eventually forcing the company to pay $75 million in cleanup costs.

Karen Wristen, executive director of Living Oceans Society, one of the plaintiffs in the legal challenge, said Thursday, "We know from Enbridge's own shoddy public safety record that tar sands oil spills have devastating consequences. Today's decision is a victory across the board: for the wildlife living in this marine environment, and for the communities living at its shores."

The social advocacy group Council of Canadians congratulated the First Nations communities and all other groups involved in the court case. The organization's executive director Maude Barlowe has previously called the opposition movement against Northern Gateway "one of the most important fights we have right now."

The court ruling also denotes an early victory for Alberta Premier Rachel Notley, who campaigned on a promise of ushering in climate-friendly policies, telling voters after a landslide victory in May 2015 that "change has finally come to Alberta. New people, new ideas and a fresh start for our great province."