CALGARY, Alberta/WASHINGTON (Reuters) - A court in Nebraska on Friday affirmed an alternative route through the Midwest state for TC Energy Corp’s Keystone XL oil pipeline in the latest chapter in the nearly 10-year legal fight over the Canada to Texas pipeline.

FILE PHOTO: Various anti-pipeline signs line the walls of the machine shed of Art and Helen Tanderup, who are against the proposed Keystone XL Pipeline that would cut through the farm where they live near Neligh, Nebraska, U.S. April 12, 2017. REUTERS/Lane Hickenbottom

The ruling lifts one of the last outstanding legal challenges facing the controversial project, which would ship 830,000 barrels per day (bpd) of crude from the Canadian oil marketing hub of Hardisty, Alberta, to Steele City, Nebraska, where it would link into an existing pipeline network feeding oil refineries on the Gulf Coast.

A judge in Montana has scheduled a hearing for Oct. 9 on a request from environmental groups to block the federal permit issued by U.S. President Donald Trump allowing the pipeline to cross the U.S.-Canadian border.

The pipeline has been subject to years of delay because of fierce environmental and landowner opposition, and has become a key symbol in the wider campaign against pipelines carrying diluted bitumen from Canada’s vast oil sands.

Canada is the world’s fourth-largest oil producer but has struggled for years to build new export pipelines, leading to deep discounts on the price of its crude and an exodus of foreign capital.

The Nebraska Supreme Court affirmed the alternative route that was approved by the state’s Public Service Commission in November 2017, even though it was not the preferred route of TC Energy, formerly known as TransCanada Corp.

That had prompted landowners and indigenous groups to sue on the grounds the PSC could only greenlight an application that was made to it.

Nebraska’s Supreme Court ruled against that argument, finding the PSC did have the power to approve a route that TC Energy had not applied for.

“The Supreme Court decision is another important step as we advance toward building this vital energy infrastructure project,” said Russ Girling, TC Energy’s chief executive said in a statement.

The company is yet to make a final investment decision on the project and independent energy investment bank GMP FirstEnergy said TC’s Energy $8 billion cost estimate will likely need to be updated.

The ruling was welcomed by Canada’s oil industry and politicians, who want better market access to help boost crude prices.

“With this decision, Keystone XL has secured approval from Canada and all three states along the pipeline’s route,” said Canada’s Natural Resources Minister Amarjeet Sohi.

Alberta Premier Jason Kenney said the court victory was another step forward after “far too many years of regulatory delays and hurdles”.

Getting more Canadian oil to the Gulf Coast would help relieve existing bottlenecks on constrained pipeline systems, the Canadian Association of Petroleum Producers said.

“We’re hopeful that this decision will be the push needed to finally get this important energy project completed,” the American Petroleum Institute said in a statement.

Opponents of the pipeline vowed to continue fighting to stop it going ahead.

“Today’s ruling does nothing to change the fact that Keystone XL faces overwhelming public opposition and ongoing legal challenges and simply never will be built,” said Ken Winston, attorney for the Nebraska Sierra Club.

Bold Nebraska, a local citizens’ groups that has fought the pipeline, said the Nebraska legislature should fix state laws that enable the court to approve a route that has not undergone adequate study and consultation.

“Our water is on the line here, and for the past decade too many politicians sat on their hands while the people did the work,” said Jane Kleeb, founder of Bold Nebraska.