The Canadian government said on Tuesday it will buy Kinder Morgan Canada Ltd’s (KML.TO) Trans Mountain pipeline project for C$4.5 billion ($3.5 billion) but does not intend to be the long-term owner of the project, which has faced fierce environmental opposition.

Finance Minister Bill Morneau said that buying the existing pipeline and its planned expansion project, which will carry crude oil from landlocked Alberta to a port in the Vancouver area, is the only way to ensure the halted project gets built.

The government will also offer federal loan guarantees to ensure construction continues through the 2018 season as part of the deal with the company, a unit of Houston-based Kinder Morgan Inc (KMI.N). Morneau said the purchase of the pipeline gives the project the federal jurisdiction needed to overcome the provincial opposition of British Columbia, but he did not say how it could force the province to allow the pipeline to be built.

“So our message today is simple: when we are faced with an exceptional situation that puts jobs at risk, that puts our international reputation on the line, our government is prepared to take action,” Morneau told reporters.

The pipeline would give Canadian crude greater access to foreign markets, but is opposed by environmental groups and some aboriginal groups.