Image copyright Reuters Image caption Steel pipe to be used for the Trans Mountain Expansion Project at a stockpile site in British Columbia

Canada has approved the Trans Mountain expansion project after a federal court sent it back for review last summer.

The decision could pose a challenge for PM Justin Trudeau as he heads into an election season likely to be fought in part over climate issues.

His federal Liberals took the rare step last year of buying the pipeline for C$4.5bn ($3.4bn; £2.6bn) to help ensure the project's survival.

Environmentalists and some First Nations fiercely oppose Trans Mountain.

Mr Trudeau on Tuesday announced the new approval and said that all revenues the federal government earns from the project will fund a "transition to a green economy".

"It is in Canada's national interest to protect our environment and invest in tomorrow, while making sure people can feed their families today," he said.

Reaction to the announcement was swift, with environmental campaigners vowing the project will not go ahead without a fight.

Meanwhile, British Columbia First Nations who have fought the project said they were considering continued legal action, and the provincial premier, John Horgan, tweeted the project "poses a great risk to our coast, our environment and our economy".

The C$7.4 bn pipeline expansion project has divided opponents, who are concerned about oil spills and climate change, and supporters, who see it as a boost for Canada's struggling energy sector - one that will help fuel the economy for years to come.

Canada ranks as the world's fifth largest producer of oil and natural gas.

What is the Trans Mountain project?

The project twins the existing 1,150 km (715 mile) Trans Mountain pipeline and would triple its capacity from 300,000 barrels per day to 890,000 per day.

It would carry crude oil from Edmonton, Alberta to Burnaby, British Columbia (BC) and increase oil tanker traffic in the area from five to up to 34 tankers a month.

Mr Trudeau says the pipeline expansion would ease Canada's reliance on the US market and help get a better price for its resource.

Business groups, oil industry workers and the Alberta government all back the project. At least two indigenous groups are actively seeking an ownership stake in the project.

The Liberal government bought the pipeline to help ensure the project's survival after energy infrastructure giant Kinder Morgan walked away over concerns about delays.

Election trouble ahead for Trudeau?

Jessica Murphy, BBC News, Toronto

Prime Minister Justin Trudeau came to power promising Canadians didn't have to choose between the environment and the economy.

So far, he's had a hard time pleasing people on either side of the issue - and Trans Mountain has played a big role in that tension.

Climate-conscious voters have begun eyeing alternatives to the Liberals, especially in British Columbia, where the project has proven an especially tough sell.

Alberta - Canada's oil heartland, which has been in a prolonged economic slump and has historically favoured conservative parties - is unlikely to be won over.

The Liberals have also made it clear they plan to fight the coming election on environmental issues - and opponents will be pushing them to explain how they can back a pipeline project and fight climate change.

Mr Trudeau on Tuesday was on the defensive, working to convince sceptics this was not an "either/or decision".

What is the background to this approval?

The Liberals first approved the Trans Mountain expansion project in 2016.

That approval was quashed last August after it was successfully challenged by a coalition of BC First Nations and environmental campaigners.

A federal court said regulators had failed to adequately consult First Nations communities and to fully account for its impact on the region's endangered killer whales.

Image copyright AFP/Getty Images Image caption Trans Mountain opponents have fought fiercely to prevent the project from being built

A new round of First Nations consultations was launched along with a review by Canada's national energy regulator on the project's impact on the coastal waters.

The regulator recommended the project be approved earlier this year.

It also issued over 160 conditions and recommendations to mitigate the environmental impacts on the whales and on the Salish Sea, a busy inland network of waterways ranging from just north of Vancouver to Puget Sound in Washington.

The federal government said it will address the recommendations and implement accommodation measures reached with indigenous communities.

Construction on the project could get under way later this year.