Kinder Morgan threatens to scrap the Trans Mountain pipeline expansion project unless legal challenges are resolved by May 31.

The Canadian government on Monday said it was considering all its options on the Trans Mountain pipeline expansion, including a possible investment of public funds to ensure construction goes ahead, after Kinder Morgan Canada halted most work on the project and set a May 31 deadline to scrap the plan.

Canada’s Natural Resources Minister Jim Carr, when asked whether the federal government would invest in the C$7.4 billion (US$5.8 billion) project, told the Canadian Broadcasting Corporation: “We are looking at all options — that’s on the table. We’re not ruling anything out. We are doing an assessment of what might be necessary, working with the government of Alberta.”

Carr’s comments follow Alberta Premier Rachel Notley’s pledge on Sunday that the oil-rich province was prepared to invest in the pipeline to ensure the project moves ahead.

Kinder Morgan Canada Chairman Steve Kean said he would scrap plans to nearly triple the capacity of the Trans Mountain pipeline, which takes crude from Alberta’s oil sands to a facility in the Pacific province of British Columbia, unless the various legal challenges could be resolved by May 31.

The project was approved by the federal government in 2016, but that approval is being challenged in court by First Nation groups and local municipalities, and British Columbia is eyeing whether it has jurisdiction to block increased oil shipments through its territory.

The 1,147-kilometer (712 mile) pipeline is considered crucial to Canadian oil producers, who are desperate to access new overseas markets. Canada sends the majority of its energy products to the United States.

The inability to get oil to ports for export means Canadian crude has been trading at a discount of up to $25 a barrel this year, costing Alberta’s heavy oil producers C$30 million to C$40 million in revenue per day.

British Columbia’s government this year proposed environmental rules that were seen as a direct attack on the Trans Mountain Expansion project. It later edged back from a pledge to block increased shipments of crude oil through the province, which had sparked a trade war with Alberta.

“British Columbians expect their government to stand up for their interests and our coast, and to do everything we can to protect our land and waters, our coastal communities and our local economies,” Premier John Horgan said in a statement.

Mike Hudema, climate campaigner with Greenpeace Canada, said: “The writing is on the wall, and even Kinder Morgan can read it. Investors should note that the opposition to this project is strong, deep and gets bigger by the day.”

Prime Minister Justin Trudeau, when asked by reporters on Monday in Montreal, reiterated that the pipeline would be built.

Many in the energy industry are concerned about whether any new pipelines can be built in Canada, which sits on the world’s third largest proven reserves of crude and is the single largest exporter of energy to the United States.

Although the federal government has the power to approve major pipelines, the 10 provinces enjoy broad responsibility for resource development. That can result in deadlock when a province opposes a decision made by Ottawa.

Last October, TransCanada Corp. abandoned its C$15.7 billion Energy East pipeline from Alberta to the Atlantic Coast amid mounting regulatory hurdles.