Last night, Justin Trudeau’s Liberal Party took power in the Canadian federal election. It was an astonishing victory. In 2011 the Liberals won only 34 seats, their worst ever performance, which left them trailing both the Conservatives and the New Democratic Party (NDP). This year they took 184 (out of 338). It’s the first time since 1925 that a party has gone from third to first place in a single election cycle. And it’s the first time ever that a third-placed party has gone on to form a majority government in the next election. Two months ago, the Liberals trailed both the NDP and the Conservatives in the polls. Last night, they took 8 per cent more of the popular vote than the Conservatives, and 20 per cent more than the NDP.

The election draws a line under ten years of Conservative government in Canada. Stephen Harper resigned as leader after his party’s defeat. As prime minister, he came to be seen by many Canadians as secretive, autocratic and cruel. He attacked charities that took political positions (such as suggesting austerity was linked to poverty). He silenced scientists who wanted to talk about climate change. He cancelled the long-form census and often refused to take questions from reporters. He ran an undignified and divisive election campaign that focused on such issues as a woman’s right to wear the niqab at citizenship ceremonies.

Yet he has left his party in a much stronger position than the Progressive Conservatives were when they lost power to the Liberals in 1993, going from 156 seats to two. The separatist Bloc Québécois became the official opposition, and the Liberals dominated the country until Harper united the fractured Canadian right and won back power in 2006. The Conservatives now have 99 seats, and poll numbers suggest that their base, for the most part, remains loyal. It would be a surprise to see the Conservatives descend into the disarray of the 1990s, but it’s telling that there isn’t a single standout candidate for the leadership.

Trudeau won in part because of the way he differentiated himself from Harper during the campaign. In opposition, he had voted for the government’s anti-terrorism legislation and so-called Zero Tolerance for Barbaric Practices Act. But on the stump he promised to run deficits to fund infrastructure spending and to raise taxes for the wealthiest Canadians, both of which the NDP’s Thomas Mulcair refused to countenance. Trudeau also benefited from an NDP crash, especially in Quebec, in the wake of the Conservatives’ anti-niqab rhetoric (Mulcair defended a woman's right to wear the niqab during citizenship ceremonies; polls indicated that 93 per cent of people in Quebec supported a ban). A large number of Liberal gains came at the expense of the NDP, who dropped from 103 to 44 seats (still their second highest total in history, which suggests 2011 might have been a blip, not a sign of things to come).

There’s a danger here for Trudeau. The strongest movement on the left of Canadian politics was less pro-Trudeau than anti-Harper. When the NDP started to slide, the anti-Harper vote rallied behind the Liberals. Trudeau may well find that his stock of public good will is lower than his seat count suggests. The good news here is that it may force him to take Canadian politics in a new direction in order to satisfy the anti-Harper movement and entrench his own support. The bad news is that he has made a lot of promises, and may have less time than he thinks to start delivering.