A Canadian court on Sept. 24 temporarily blocked legislation enabling the province of Alberta to restrict oil and gas flows to British Columbia, saying the constitutionality of the measure would be decided at a later trial.

Alberta enacted Bill 12, dubbed the "turn off the taps act" in May, after it was passed by the previous provincial government in retaliation for British Columbia opposing the expansion of the Trans Mountain oil pipeline.

Bill 12, formally known as the "Preserving Canada's Economic Prosperity Act", has yet to be used to cut energy shipments. However, Alberta Premier Jason Kenney said it would provide leverage in discussions with British Columbia counterpart John Horgan.

British Columbia's lawyers filed court actions against Bill 12 and on Tuesday the federal court said the province had met the criteria for a temporary injunction by showing the legislation would cause harm to its residents.

"The Court rejected Alberta's argument that this harm is speculative, finding that it was reasonably certain and noted that whether or not the harm is triggered lies entirely within Alberta's discretion," the court said in its ruling.

The federal court will set a date for a trial to hear British Columbia's application for the legislation to be ruled unconstitutional.

"In our reading of the constitution Alberta is not allowed to restrict the flow of refined products to other provinces to punish them for positions that are taken that they do not like," said David Eby, British Columbia's Attorney General.

The Trans Mountain expansion project, which would nearly triple the flow of crude from Alberta's oil sands to British Columbia's coast, is an ongoing source of disagreement between Canada's two westernmost provinces.

Entrenched environmental opposition and regulatory delays have held up the project for years and court challenges are ongoing despite the federal government buying the pipeline last year for C$4.5 billion to help to facilitate construction.