Media playback is unsupported on your device Media caption Four years of Justin Trudeau in two minutes

The polls have opened, and Canadians will now decide whether to give Prime Minister Justin Trudeau's Liberal party a second term.

The parties have been making their pitches to voters over the past five weeks - and have not shied away from attacks on opponents.

Now it's time for the voters to get to work and cast their ballots.

Here are five things to know.

1. It's a referendum on Trudeau

After winning a historic, come-from-behind victory four years ago, Liberal leader Justin Trudeau, 47, is seeking re-election.

He has kept a number of key promises - from legalising recreational cannabis to bringing in a means-tested child benefit programme - but he also failed to follow through on some major commitments.

A vow to overhaul of Canada's electoral system was dropped and a pledge to balance the budget this year has been broken.

And while the Canadian public had a longer than usual political honeymoon with Mr Trudeau, he's since lost some of his lustre.

Image copyright AFP/Getty Images Image caption Trudeau was criticised for photo-ops during his trip to India

First, Mr Trudeau was found to have broken federal ethics rules by taking a tropical vacation to the island owned by the Aga Khan, the philanthropist and spiritual leader, in 2016.

Then came a disastrous overseas trip to India.

Taking place against a backdrop of photo-ops showcasing the Trudeau family in elaborate traditional Indian outfits, the trip was light on formal business and ended in controversy when an alleged Canadian Sikh separatist was invited to official events.

Media playback is unsupported on your device Media caption What do Canadians think of Trudeau's record?

Then came a third hit - the SNC-Lavalin affair, a political crisis related to attempts to pressure a former attorney general to cut a deal for a firm facing a corruption trial, which tarnished Mr Trudeau's personal brand with Canadians.

He has also faced criticism after his government bought a C$4.5bn ($3.4bn; £2.8bn) oil pipeline to help ensure its expansion and for not cancelling a controversial arms deal with Saudi Arabia.

Mr Trudeau says he remains the best option for Canadians who want a progressive government - but he can no longer campaign as an outsider on a promise of change.

"He now has a record to run on," said political scientist Alex Marland.

Media playback is unsupported on your device Media caption "Long time ago" - Canadians react to Trudeau brownface images

Mr Trudeau's own personal history has also become a stumbling block for his re-election bid, after three instances of him wearing blackface or brownface - widely accepted as racist caricatures - came to light during the campaign.

The most recent incident was in 2001, and he has been forced to ask Canadians to forgive him.

2. There are some fresh faces

Conservative leader Andrew Scheer has the best shot of unseating the prime minister - but the 40-year-old was a relative unknown after winning the party's leadership vote by a whisker in 2017.

Nor does he have "the celebrity-ness of Justin Trudeau," said Matthew John, with government relations firm Crestview Strategy, who has ties to the party.

Mr John said he would be watching whether Mr Scheer could "cut through with his own brand and his own unique offering to Canadians to get his share of media".

This will also be the first federal campaign for the NDP's Jagmeet Singh, 40, who took the helm of the left-leaning party two years ago.

His party struggled to raise funds, a third of his caucus chose not to run again, and the party was slow to announce a full slate of candidates.

Image copyright BBC News Image caption Federal party leaders vying for votes in Canada's 2019 general election

Early in the campaign, political analysts were predicting the party could lose a significant portion of their seats. Still, NDP insider Anne McGrath said that while there were challenges, going into a campaign as an underdog meant they could "outperform expectations".

It was a chance "for people to actually take - I wouldn't even say take a second look - take a first look at [Singh]", she said.

People have. Though his party remains in third place, his campaign has gained momentum in the final lap and polls indicate voters see him as the most likable of all the leaders.

Image copyright AFP via Getty Images Image caption Bloc leader Yves Francois Blanchet helped revive the party that had been sidelined by voters in recent elections

The sovereignist Bloc Quebecois, a federal party focused on the promotion of Quebec interests, also has a new leader, Yves-Francois Blanchet, 54. The party has captured the attention of voters in that province - the only region where it runs candidates - and is projected to make significant gains.

Meanwhile, Green Party leader Elizabeth May, 65, is a campaign veteran, and this was her fourth general election.

3. Climate change is a big deal

Pocketbook and economic issues have featured prominently with Canadians in this election, as well as the environment.

The economy is showing signs of momentum and unemployment is at near historic lows - but not all families feel they're getting ahead.

In 2018, the average Canadian owed $1.74 for every dollar they earned - the highest debt to income ratio in the G7. Sky-high housing prices in cities like Toronto and Vancouver means home ownership is a challenge.

Image copyright AFP/Getty Images Image caption Climate change policy is on the agenda for Canada's 43rd general election

The Liberals are touting achievements like their child benefits programme, which helped pull some 278,000 children from poverty in 2017, according to federal statistics.

The Conservatives are focusing their message on Canadians anxious about their financial future.

One sharp battle line has been drawn over the federal carbon tax, which was imposed on four of Canada's 10 provinces that had failed to introduce their own plans for tackling climate change.

The national price on carbon emissions is central to the Liberals' effort to meet the country's Paris Agreement commitments.

Media playback is unsupported on your device Media caption What's more important to Canadians — the economy or the environment?

While it will increase things like petrol and fuel costs, the party argues those costs are returned to Canadians through an annual tax rebate.

But "there are lots of people - maybe even ones who think [climate change] is a problem - who say 'I don't have the money right now'", said Mr John.

Mr Scheer, who has called it an "unfair tax on everything", has vowed to repeal the carbon tax as his first order of business if elected.

The NDP is also carving out a niche over affordability by talking student debt, housing and child care.

While voters say they want campaigns to focus on the economy, climate and healthcare, Mr Marland said the ballot box question is likely to boil down to: "Do I want Justin Trudeau to continue to be prime minister of Canada or not?"

4. It's still close

The Liberals had steadily been clawing back support after their numbers cratered earlier this year in the wake of the SNC-Lavalin affair.

At the beginning of the campaign, national polls suggested the Liberals and the Conservatives were running roughly neck-and-neck with just over 30% of the popular support each at the beginning of the campaign.

They are ending it pretty much in the same position - though each has seen their support dip.

Image copyright Getty Images Image caption Canadians head to the polls on 21 October

The NDP is placed a distant third nationally but began with roughly 14% of Canadian voters saying if they were to vote today, they would cast a ballot for that party and are now hovering around 18% to 20% support, depending on the survey.

The Bloc Quebecois gained the most ground, and is now nipping at the Liberals' heels in Quebec.

5. Could be a good election for wildcards

The Green Party got a lot of buzz over the summer. It was polling at historic highs - in some surveys tied with the NDP - and has hopes to more than double the seat count from two to at least five.

There's a feeling of "cautious optimism" in the war room, said campaign manager Jonathan Dickie.

Image copyright Reuters Image caption Independent candidates Jane Philpott (L) and Jody Wilson-Raybould (R)

The Greens are "trying to position [themselves] a little outside the political spectrum" and angling for voters "willing to take a little bit of risk", he says.

While they could still pick up seats, progressive voters looking for an alternative to Mr Trudeau's Liberals might be getting their heads turned by the buzz around the NDP.

Two other candidates hoping to defy long-shot odds are Jody Wilson-Raybould and Jane Philpott.

Both were prominent Liberal Cabinet ministers before they resigned in protest over the SNC-Lavalin affair and were eventually booted from caucus by Mr Trudeau.

They are now running as independent candidates in ridings (constituencies) they won as Liberals in 2015, without the support of a party campaign machine behind them.

Ms Wilson-Raybould told the BBC in September that she was "embracing the reality of being an independent candidate".

"We need to, as much as we can, take off our partisan hats and have discussions about issues," she said.