Media playback is unsupported on your device Media caption Justin Trudeau: "On behalf of 35 million Canadians, we're back"

Canadian Prime Minister-designate Justin Trudeau says the country has reclaimed its Liberal identity, after a decisive election victory that ended nearly a decade of Conservative rule.

"I want to say to this country's friends all around the world," he told a rally in Ottawa, "on behalf of 35 million Canadians - we're back."

His Liberal Party began the campaign in third place but now has a majority.

Mr Trudeau, an ex-high-school teacher, is the son of late PM Pierre Trudeau.

The BBC's Nick Bryant in Toronto says there is jubilation, but also an air of nostalgia about his victory, as the prime minister's residence is also his childhood home.

Addressing cheering supporters alternately in French and English, Mr Trudeau said: "This afternoon we can celebrate but the work is only beginning".

Meet Justin Trudeau

Young Canadians' hopes

Seven key Trudeau policies

Trudeau's to-do list

During the 11-week election campaign, the Liberal Party said it would:

Cut income taxes for middle-class Canadians while increasing them for the wealthy

Run deficits for three years to pay for infrastructure spending

Do more to address environmental concerns over the controversial Keystone oil pipeline

Take in more Syrian refugees, and pull out of bombing raids against Islamic State while bolstering training for Iraqi forces

Legalise marijuana

Media playback is unsupported on your device Media caption Stephen Harper admits defeat

Why Harper lost

Where did Conservative Prime Minister Stephen Harper go wrong? After such a resounding defeat, even supporters admit some policies have backfired.

Misreading austerity mood

His economic message - based on low taxes and balancing the books - seemed to exaggerate Canada's ability to ride out the global downturn, whereas Mr Trudeau focused on how many people felt.

Appearing to be mean-spirited

Mr Harper leader took a hard line on Syrian refugees and opposed the wearing of the niqab at citizenship ceremonies.

While there was support on both these issues, the tipping point came after he suggested a police hotline to report "barbaric cultural practices".

Rallying liberal opponents

Bill C51, which strengthened powers of surveillance, rallied many against a perceived attack on civil liberties.

Falling out with Obama

The two leaders never warmed to each other. Mr Harper pushed the Keystone XL pipeline hard on a lukewarm US president.

According to a newspaper, Mr Harper was "deeply frustrated" with a president who he felt was "incapable of making a difficult decision".

Failing to clean up politics

In 2006, Mr Harper pledged to clean up politics and he introduced a bill to increase accountability but failed to keep more than half of the pledges.

Harper's miscalculations

Twitter reaches out to wrong Harper

From austerity to deficit

The economy loomed large during the campaign. Mr Harper highlighted his legacy of balanced budget and tax cuts, while Mr Trudeau pointed to sluggish growth to support his calls to boost demand through public spending.

Mr Trudeau's infrastructure policy is projected to cost C$10bn in the first two years, equivalent to 0.5% of Canada's GDP - tipping the federal budget into deficit. But, BBC business reporter Robert Plummer says, if the money is spent on the wrong kind of infrastructure, it may not do any good, while saddling the government with unnecessary debt.

Whatever happens, richer Canadians can expect to face a higher tax bill, handing over more than half their income in combined federal and provincial taxes, while ordinary people can look forward to tax breaks.

And in the short term, Mr Trudeau's policies may help stabilise the economy, making it unlikely that the Bank of Canada will cut interest rates further - meaning borrowing costs should remain low and house prices relatively high.

What now for Harper?

Mr Harper, one of the longest-serving Western leaders, had been seeking a rare fourth term.

He will now stand down as Conservative leader but remain as an MP, his party says.

There is no fixed transition period under Canada's constitution. Mr Trudeau is expected to be sworn in in a few weeks' times.