Justin Trudeau's Liberal Party has retained power in a narrow Canadian election win but he will now be prime minister of a minority government.
The Liberals are projected to win 157 seats, 13 short of a majority, and will find it harder to pass legislation in Mr Trudeau's second term.
The opposition Conservatives are expected to win the popular vote but have not translated that into seats.
They are projected to take 121, up from the 95 they held before.
Although Monday night's results saw a sharp decline in seats for the country's left-leaning New Democratic Party (NDP), its leader, Jagmeet Singh, could become the kingmaker.
The NDP is projected to take 24 seats in the 338-seat parliament.
Quebec's separatist party, the Bloc Québécois, which competes only in that province, fared much better. It is expected to take 32 seats, compared to the 10 it won in 2015.
Turnout is currently listed at 66%.
The federal election was seen as a referendum on Mr Trudeau, who had a bumpy first term, tainted by scandal.
Mr Trudeau told cheering supporters in Montreal that voters had "rejected division and negativity... and they rejected cuts and austerity and voted in favour of a progressive agenda and strong action on climate change".
He said: "Thank you for having faith in us to move our country in the right direction."
And to those who did not back him, he promised his party would govern for everyone.
His weakened grip on power is being seen as a rebuke of his record but the result is bitterly disappointing for Conservative leader Andrew Scheer.
Why has Trudeau's popularity fallen?
Mr Trudeau swept into power in 2015 promising "real change" and a slew of progressive pledges.
But after four years in power, Mr Trudeau faced criticism for his ability to follow through.
His environmental record, for example, has been undercut by his support for the Trans Mountain oil pipeline expansion project.
And Mr Trudeau's vow to institute federal electoral reform was quickly abandoned, angering some left-leaning voters excited by the prospect of seeing an alternative voting system
Still, according to an independent assessment by two dozen Canadian academics, Mr Trudeau has kept - fully or partially - 92% of these promises, the most by any Canadian government in 35 years.
An ethics scandal early this year, known as the SNC-Lavalin affair, took a major toll on his support.
Last month an ethics watchdog found the prime minister had violated federal conflict of interest rules by improperly trying to influence a former minister in relation to a criminal trial facing major Canadian engineering firm SNC-Lavalin.
Mr Trudeau's election odds then seemed at risk when images of the prime minister wearing blackface make-up in three separate instances were widely circulated.
The images were seen as a major hit to Mr Trudeau's cultivated political image, characterised by compassion and inclusion.
What have the leaders said?
In his speech, Mr Trudeau also addressed Quebec and the provinces in western Canada, where his party had not fared well, saying: "I've heard your frustration."
Thank you, Canada, for putting your trust in our team and for having faith in us to move this country in the right direction. Regardless of how you cast your vote, our team will work hard for all Canadians.— Justin Trudeau (@JustinTrudeau) October 22, 2019
Mr Scheer said he was "incredibly proud" of the larger Conservative team going to Ottawa.
He said the country was "further divided" and that his party had put Mr Trudeau "on notice, his leadership is damaged and his government will end soon".
The Conservatives are projected to take 34.4% of the popular vote, compared to the Liberals' 33%. However, the first-past-the-post system - awarding victory to the candidate with most votes in any given constituency - means that has not translated to seats won.
Speaking from his home district in Burnaby, British Columbia, Mr Singh acknowledged some disappointing results but focused on the future, promising to make "Canadians' life... better".
Green Party leader Elizabeth May said the election had been a success. It is expected to take three seats, compared to one in 2015.
US President Donald Trump and UK PM Boris Johnson tweeted congratulations to Mr Trudeau.
Congratulations to @JustinTrudeau on a wonderful and hard fought victory. Canada is well served. I look forward to working with you toward the betterment of both of our countries!— Donald J. Trump (@realDonaldTrump) October 22, 2019
“Congratulations @JustinTrudeau on your re-election. As Commonwealth, NATO, and Five Eyes partners the UK and Canada share history and values and I look forward to continuing to work with you on priorities such as girls’ education and climate change.” – PM @BorisJohnson 🇬🇧🇨🇦— UK Prime Minister (@10DowningStreet) October 22, 2019
What next for Canada?
Minority governments are not uncommon - there have been three in the past 15 years.
A coalition government, however, is rare. It was last attempted in 2008 by the Liberals and NDP, but was disbanded when then-Prime Minister Stephen Harper, a Conservative, prorogued parliament.
Analysts believe the obvious link would again be between the Liberals and the NDP. They also believe the Bloc Québécois - which has softened its stance on demands for independence - will neither enter a coalition nor force another election.
Indeed, in his post-results speech, Bloc leader Yves-François Blanchet said: "We have to find a way to make this parliament work."
Without any agreed coalition, Mr Trudeau would clearly need to compromise to get policies through.
Mr Scheer will have to assess his position. He pitched himself to Canadians as the candidate speaking up for issues which directly affect voters' lives and wallets.
But instead he faced scrutiny over where the Conservative Party stood on gay marriage and abortion.