The Canadian government has agreed to buy Kinder Morgan Canada Ltd.’s (KML) Trans Mountain Pipeline at least temporarily as the only sure way to build the hotly contested oilsands export expansion of the conduit from Alberta to the southern Pacific coast of British Columbia (BC).

“This is an investment in Canada’s future,” Canada Finance Minister Bill Morneau said in announcing the C$4.5 billion ($3.6 billion) agreement Monday morning for the 1,150-kilometer (920-mile) pipeline to a tanker dock in the Vancouver suburb of Burnaby.

Morneau echoed Prime Minister Justin Trudeau, who told the Canadian Parliament shortly before the deal was unveiled, “It is in the national interest to go ahead with it and that’s why the pipeline will be built.”

Up to C$2 billion ($1.6 billion) more public money has also been committed by the Alberta government as an emergency fund to cover unpredictable expenses to complete the Trans Mountain Expansion Project (TMEP).

A Canadian Crown corporation will be set up to own the pipeline and manage the TMEP, which is currently forecast to cost C$7.4 billion ($5.9 billion) to triple capacity to 890,000 b/d.

Morneau predicted government ownership would be temporary, with efforts beginning immediately to arrange a resale to a consortium of pension funds, native communities and other investors that have already expressed interests.

He pledged to protect prospective Trans Mountain buyers against the risk that led KML into selling the pipeline: resistance against the TMEP by BC’s left-leaning coalition New Democratic Party and Green Party government.

“Any purchaser of the project would be covered by a federal indemnity protecting them against any financial loss posed by politically motivated unnecessary delays, in line with the indemnity offered to Kinder Morgan by the government on May 16, 2018,” said the finance department.

Morneau’s risk insurance offer two weeks ago fell short of offsetting conflicts that Kinder Morgan Inc. Chairman Steve Kean described as making the project outlook “untenable” for a private corporation.

On Monday Kean said, “The outcome we have reached represents the best opportunity to complete TMEP.”

The fights continue, with verdicts still to come on native and environmental protest lawsuits while the BC and Alberta governments trade threats to punish each other by interfering with oil and refined products traffic in Trans Mountain. The threats have swiftly generated additional lawsuits.

Morneau’s announcement immediately prompted more protest vows to resist the project in the name of preventing offshore oil spills and stopping thermal tar sands production blamed for increasing Canadian carbon emissions. The bitumen extraction plants stand out as the nation’s largest, fastest-growing natural gas consumer.

However, none of the protests or court cases to date resulted in injunctions that would stop work or a verdict to overturn any aspect of the 2016 TMEP approvals by the National Energy Board (NEB) and the federal cabinet.

Construction, suspended since late April, is to resume as early as this summer and the ownership takeover should be completed before the end of this year, the finance department predicted.

An investor consortium will also be sought, with the government offering a deal sweetener: an option to buy back Trans Mountain if the courts overturn the TMEP approvals or the conflicts make hitting a reasonable completion target impossible.

While the agreement to sell Trans Mountain shrinks KML by taking away its 65-year-old primary asset, the company keeps a network of oil storage and rail terminals, an ethane pipeline, and a Vancouver Harbor mineral export-import wharf.

“The announced sale by Kinder Morgan Canada…is credit positive for Kinder Morgan Inc.,” said Moody’s Investors Service’s Terry Marshall, senior vice president. “The sale removes the significant risk attached to the TMEP expansion, eliminating at least C$6.4 billion — before potential cost overruns — of additional capital to complete the project and the uncertainty of construction scheduling and completion, given the opposition to the project from various stakeholders.”