Justin Trudeau has won a second chance.

Four years ago, that might have seemed inevitable. But as recently as a week ago, it seemed very possible that the Liberals were going to finish in second place. A month ago — when those images of the "Arabian Nights" gala in 2001 were published — it seemed like Trudeau might be finished entirely.

By those recent standards, this is an incredible victory for the Liberal Party. By any measure, a victory is preferable to the alternative. This one will have seismic impacts on the short-term and long-term future of federal policy in this country — not least for climate policy.

But it's not an unmitigated success. When all the ballots are counted, the Liberals may turn out to have won fewer votes than the Conservatives. And this win comes with significant challenges.

After failing to win a single seat in Saskatchewan or Alberta, Liberal Leader Justin Trudeau says he has heard those provinces' frustrations. 2:01

With less than half of the seats, Trudeau's Liberals will have to keep angling and negotiating to win each day in the House of Commons. With just four seats between Thunder Bay and the Rocky Mountains, the Liberals will be newly challenged by questions about the restive West. And suddenly, the Bloc Québécois is a significant presence again.

The next act of Trudeau's remarkable political career will depend on what he takes away from the experiences of the last five weeks and the previous four years — what he has learned and how he chooses to apply himself to the challenges this election result has laid out before him.

"I have heard you, my friends," Trudeau said shortly after 1 a.m. on Tuesday. "You are sending our Liberal team back to work."

See you in two years

Earlier in the evening, when the networks began to project a Liberal government, supporters at Trudeau's election night celebration chanted "four more years." Trudeau will be lucky to get that far before the next election. Something closer to two years is more likely.

Time will be of the essence. But limitations might sharpen Trudeau's focus, as the setback of 1972 did for his father.

"His determination after the 1972 election not only to govern strongly but also to lay the foundation for a new Liberal majority had a major impact on his administration," John English wrote in his book Just Watch Me, describing how Pierre Trudeau responded to narrowly winning a minority government just four years after Trudeaumania hit.

"[F]irst, he was less cautious and more willing to take chances; and second, he considered the expressly political consequences of his government's decisions and actions far more often than he had before."

Two years later, Pierre Trudeau's Liberals were restored to a majority.

The first four years of Justin Trudeau's government might suggest a need to both take more chances and take more care — to move more aggressively on policy, but to be more mindful of the political damage that can be done when you aren't careful about how you run your government.

Every election is a cause for reflection and a chance to start again. Canadians have not chosen to start on an entirely new course. But Trudeau will have a chance to think about how he moves forward.

Ralph Goodale leaves a gap

The cabinet that Trudeau brought into this election is almost entirely intact, but it has lost its most experienced and steadiest member: Ralph Goodale. Someone with Goodale's knowledge and skill would have been particularly valuable in a minority situation.

In 1972, Pierre Trudeau turned to Allan MacEachen, the masterful House leader, to keep the Liberal government moving. Justin Trudeau could use someone like that. Goodale might have been that someone.

Trudeau is seen at a media event with Ralph Goodale, a Liberal veteran who lost his seat in Saskatchewan on Monday night. (Canadian Press)

Regardless, Trudeau will have to restructure his cabinet. The Prime Minister's Office could also be shuffled. Gerry Butts, who left Trudeau's office in the midst of the SNC-Lavalin affair but returned for the election campaign, is unlikely to return to the PMO.

The victory party on Monday night in Montreal was not packed to capacity — and the mood seemed closer to reflection or relief than revelry.

The "what ifs" that hang in the air could fill a few chapters in a book. What if Trudeau had just worn a suit when he went to India? What if he hadn't shuffled Jody Wilson-Raybould from the justice portfolio? What if he'd admitted to the blackface photo three years ago?

Can Trudeau learn from his mistakes?

Maybe doing those things would have won the Liberals another 20 seats. Or maybe Trudeau would have made different mistakes. He's a politician blessed with significant advantages, but he has often found ways to make things more difficult for himself.

He should resolve to stop doing that — but it has to be acknowledged that Trudeau has come through on multiple occasions when the odds did not seem to be in his favour. His resilience — or the durability of his connection with the public — should not be underestimated.

He may have saved his campaign, and his government, by responding to the blackface photos as he did: standing in a public square in Winnipeg and taking every question the travelling press corps could muster. And he closed this campaign with a flourish, significantly buoyed by the endorsement of his old friend, Barack Obama.

On stage in Montreal, Trudeau framed the election result as a win for a "progressive" agenda and a loss for the Conservative alternative. The parliamentary math likely will require him to regularly satisfy either the Bloc or the NDP, and that may give him licence to lean into that progressive agenda. The Conservatives may go looking for another leader, giving Trudeau more time and room to operate.

The achievement of winning any more time in power at all is not a small one. He fought a campaign with climate policy front and centre — and he won.

But his reward is limited and fraught with questions about national unity.

Now, more than ever, he must use his time very wisely.