CALGARY -- A Federal Court judge has granted the British Columbia government a temporary injunction against an Alberta law that could have limited oil exports to other provinces.

In a decision released Tuesday, Justice Sebastien Grammond said Alberta's so-called turn-off-the-taps legislation raises a serious issue and could cause irreparable harm to the residents of B.C.

"British Columbia has met the criteria usually applied by the courts for the issuance of such an injunction," he wrote in his decision.

"It has shown that the validity of the act raises a serious issue. It has demonstrated that an embargo of the nature evoked by the members of Alberta's legislature when debating the act would cause irreparable harm to the residents of British Columbia."

The B.C. government initially brought the action before Alberta's Court of Queen's Bench, which passed it to the Federal Court.

Alberta tried to strike the action by arguing that it wasn't in the jurisdiction of the Federal Court, but the judge dismissed that motion.

Grammond said B.C. has met the test for blocking the law until the courts can decide its validity.

B.C. Attorney General David Eby said he's pleased the injunction was granted and the case will be going to trial.

"We think it's quite a straight forward case, but the ultimate decision will of course be up to the court," he told reporters in Vancouver.

"On our reading of the Constitution, Alberta is not allowed to restrict the flow of refined product to other provinces in a way to punish them for political positions that are taken they don't like," said Eby. "That's our understanding of the Constitution. Alberta has a different understanding and the court will be deciding about that."

The turn-off-the-taps legislation gives Alberta the power to crimp energy exports from the province.

It was passed, but never used, by Alberta's former NDP government as a way to put pressure on B.C. to drop its fight against the Trans Mountain oil pipeline expansion to the West Coast.

The new United Conservative government proclaimed it into force shortly after Premier Jason Kenney was sworn into office in April, but he had said it wouldn't be used unless B.C. throws up further roadblocks to the pipeline.

B.C. had called the law a loaded gun and had asked the courts to make sure it didn't accidentally go off.

NDP Leader Rachel Notley said that the injunction has rendered the law useless.

"We told the premier not to proclaim this legislation because it would be like blowing up the missile while it's still on the launchpad," she said in a news release.

"And that's exactly what has happened today. This injunction has rendered the legislation powerless. Any further threats from the premier to turn off the taps are empty."

Kenney was expected to speak about the decision later Tuesday.

Grammond said in his decision that members on both sides of the Alberta legislature explained the law's purpose in relation to the British Columbia government's actions on the Trans Mountain expansion project.

"These statements make it abundantly clear that the purpose of the act is to inflict economic harm to British Columbia through an embargo on the exportation of petroleum products to that province," he said.

The embargo, he said, would not only cause a considerable increase in the price of gas and diesel in the province, but any fuel shortages could also endanger public safety.

The Trans Mountain expansion, first approved in 2016, would triple the amount of oil flowing from the oilsands to B.C.'s Lower Mainland and from there to lucrative new markets across the Pacific.

The federal government bought the existing pipeline last year for $4.5 billion after its original builder, Texas-based Kinder Morgan, threatened to walk away from the project because of B.C.'s resistance.

The Federal Court of Appeal quashed the approval months later on the grounds that there hadn't been enough consultation with First Nations or consideration of the pipeline's potential impact on marine wildlife.

The project was approved for a second time by the federal cabinet this summer.

This report by The Canadian Press was first published Sept. 24, 2019.

-- By Colette Derworiz in Edmonton, with files from Dirk Meissner in Victoria