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

Canadian Prime Minister Justin Trudeau has called a federal election for 21 October.

Opinion polls are indicating it will be a tough race for Mr Trudeau, who is seeking a second term in office.

The campaign is expected to focus on issues of affordability, the economy and climate issues.

The prime minister visited the Governor General, the Queen's representative in Canada, on Wednesday morning to formally launch the campaign.

Mr Trudeau touted his accomplishments on the economy and the environment in an announcement, saying: "Canadians once again get to vote for the country they want to live in".

Media playback is unsupported on your device Media caption "We're just getting started": PM Trudeau announces the vote

Canada has a federal fixed election date and Canadians must head to the polls every four years. This campaign will be a relatively short 40 days, or just over five weeks.

Over the summer, the rival parties have been honing their message, focusing on the economy and cost-of-living.

They have also sharpened their attacks against Mr Trudeau, who they say has not lived up to the expectations of Canadians.

Mr Trudeau will have to defend his record, including his handling this year of an ethics crisis that proved politically costly.

The prime minister was found by a federal ethics watchdog to have improperly tried to influence a former minister over the prosecution of SNC-Lavalin, a major engineering and construction company facing a criminal trial.

That affair was raised on Wednesday morning by Conservative leader Andrew Scheer, who issued a rebuke against the Liberal leader, saying Canadians "cannot trust Justin Trudeau".

Image copyright AFP Image caption Prime Minister Justin Trudeau and his wife, Sophie Gregoire, arrive at Rideau Hall

Can Trudeau recreate the magic?

Jessica Murphy, BBC News, Toronto

Justin Trudeau swept to power four years ago on a surge of support that coalesced around the Liberal Party, ending nearly a decade of Conservative rule.

His decisive victory was helped by many first-time and young voters who cast ballots for the Liberals, excited by Mr Trudeau's leadership, the positive tone of his campaign and the possibility of change.

Now the question is whether Mr Trudeau can conjure the campaign magic that led to that historic victory.

The young, progressive leader had an exceptionally long political honeymoon with the Canadian public.

He followed through on some major commitments - legalising recreational cannabis, championing gender equality, opening Canada's doors to Syrian refugees.

But he has struggled in recent months following a series of political fumbles and an ethics scandal.

And he has made decisions that have frustrated parts of his progressive base, including buying a major oil pipeline to ensure its expansion and scrapping a promise to reform Canada's electoral system.

The campaign is currently shaping up to be a battle between two parties: the Liberals and the Conservatives.

National polls indicate they are in a dead heat, with both on just over 30% support.

Mr Trudeau has been working hard to draw a clear contrast between the two parties, and he has faced some accusations of negative campaigning.

"I do not engage in personal attacks but I will be very, very sharp on distinctions around policy," he said on Wednesday.

The NDP are polling nationally in third place, on roughly 13%-14% support, with a slight lead over the Green Party.

Image copyright Getty Images Image caption NDP Leader Jagmeet Singh is running as a champion for "everyday" Canadians

Who's in the running?

Mr Trudeau was an untested leader in 2015 when he won a majority government. Now, it's his turn to face opponents who are unproven campaigners.

His main rival is the Conservative Party's Andrew Scheer.

Mr Scheer, 40, formerly the youngest-ever speaker in Canada's House of Commons, took the helm of the right-leaning party in 2017.

Another fresh face in federal politics is Jagmeet Singh, 40.

The leader of the left-leaning New Democrats (NDP), he is the first person of colour to have taken the helm of a major federal political party in Canada.

The separatist Bloc Quebecois, under new leader Yves-Francois Blanchet, will be competing for seats against the Liberals, Conservatives and the NDP in Quebec, a crucial battleground province in federal politics.

The Bloc only runs candidates in that province.

The Green Party, led by Elizabeth May, will be focusing efforts on trying to break through in British Columbia and Atlantic Canada.