VANCOUVER - British Columbia lost the largest tool in its toolbox to halt the Trans Mountain pipeline expansion with a court decision Friday that concluded it can't restrict oil shipments through its borders.

The unanimous ruling from the B.C. Court of Appeal represented a major win for the project, which the federal government and Alberta see as crucial to getting more oilsands crude to overseas markets.

B.C.'s minority NDP government, which took power on a promise to use every tool available to stop the expansion, swiftly announced plans to appeal to the Supreme Court of Canada.

“Our government said from the outset that we would stand up for British Columbia's environment, our economy and our coast,” said Attorney General David Eby. “Thousands of jobs and billions of dollars in economic activity would be put at risk by a diluted bitumen spill.”

The province filed a constitutional reference question to the Appeal Court that asked whether it had the authority to create a permitting regime for companies that wished to increase their flow of diluted bitumen.

A five-judge panel agreed that the amendments to B.C.'s Environmental Management Act were not constitutional because they would interfere with the federal government's exclusive jurisdiction over interprovincial pipelines.

Justice Mary Newbury wrote on behalf of the panel that the overall aim of the proposed amendments was to place conditions on and, if necessary, prohibit the movement of heavy oil through a federal undertaking.

Newbury also wrote that the legislation is not just a general environmental law, but is targeted at one substance in one interprovincial pipeline: the Trans Mountain expansion project.

“Immediately upon coming into force, it would prohibit the operation of the expanded Trans Mountain pipeline in the province until such time as a provincially appointed official decided otherwise,” she said.

“This alone threatens to usurp the role of the (National Energy Board), which has made many rulings and imposed many conditions to be complied with by Trans Mountain for the protection of the environment.”

The energy board is the body entrusted with regulating the flow of resources across Canada to export markets, Newbury wrote.

B.C. argued that the proposed amendments were meant to protect its environment from a hazardous substance, while the federal government and Alberta said the goal was to block Trans Mountain.

Alberta Premier Jason Kenney said the decision is an occasion for “real hope” for hard-working people and the project will allow his province to realize a fair price for its resources and create new jobs.

“In light of the court's decision, we hope that the B.C. government will respect the rule of law and end its campaign of obstruction,” he said.

Kenney also said the expansion could provide much-needed relief at B.C. pumps. Premier John Horgan has disputed that the project would ease sky-high gas prices, noting its purpose is to transport heavy oil for shipment overseas.

Trans Mountain Corp. said it agreed that the legislation was unconstitutional and it shares the value that Canadians and B.C. residents place on the environment.

Eby said his government originally asked Canada to join it in a reference case before the Supreme Court. The federal government declined, so B.C. had to first file its case with the provincial Appeal Court, he said.

The Supreme Court of Canada automatically hears provincial reference questions. Eby said the top court has overturned unanimous B.C. Appeal Court judgments in the past and the cost of pursuing the case was worth it.

“It is a fraction of a fraction of the cost of a diluted bitumen spill,” he said.

Saskatchewan, Enbridge Inc. and the Canadian Association of Oil Producers argued in court against B.C.'s proposed permit regime, while some First Nations, cities and environmental groups supported it.

The Haida and Heiltsuk Nations said the decision was a missed opportunity for reconciliation because it failed to acknowledge their arguments about the role of Indigenous governments in environmental protection.

Heiltsuk Chief Coun. Marilyn Slett called the ruling “offensive and irresponsible.”

“It is unacceptable that despite being granted interested party status, the court failed to even acknowledge ours or any other Indigenous governments' arguments in its decision. They invited us into the room, but they completely ignored us,” she said in a statement.

Lawyer Kegan Pepper-Smith represented Ecojustice in the case and said the decision leaves B.C., its communities and environment exposed to a potentially disastrous spill.

There is still plenty the B.C. government could do to stop the Trans Mountain expansion, such as adding conditions to its provincial environmental certificate, said Peter McCartney, a climate campaigner with the Wilderness Committee.

The proposed amendments would have meant that Trans Mountain Corp. and any other company wishing to increase the amount of heavy oil it transported through B.C. would have had to apply for a “hazardous substance permit.”

The permit application would have had to detail the risks to human health and the environment from a spill, plans to mitigate those risks and financial measures, including insurance, that ensured payment of cleanup costs.

A provincial public servant would have had the authority to impose conditions on a hazardous substance permit and cancel or suspend the permit if the company did not comply.

B.C. announced the amendments last year, prompting then-Alberta premier Rachel Notley to ban B.C. wines. After Horgan promised to file a reference case asking whether the amendments were constitutional, Notley cancelled the wine ban.

Prime Minister Justin Trudeau's government has purchased the Trans Mountain pipeline and expansion project for $4.5 billion. Construction was paused last August after the Federal Court of Appeal overturned the federal permits.

The project would triple the pipeline's capacity to carry diluted bitumen from the Edmonton area to Metro Vancouver and increase the number of tankers in Burrard Inlet seven-fold.