There’s an old joke that goes: Why did the Canadian cross the road? Answer: to get to the middle of the road. Likewise (so they say) if you cut the average Canadian open you would find two words engraved on his or her heart. One would be “moderate.” The other would be “nice.”

Prime Minister Stephen Harper, who was four months short of 10 years in office when he was swept out of power in Monday’s election, was a moderate right-wing politician, although he pretended to be a hard right one. Six of his 10 budgets were in deficit, and he ended up adding $150 billion to Canada’s national debt. Even when faced with a global recession, that’s not what hard-right politicians do.

Similarly, the New Democratic Party is a very moderate left-wing party by anybody’s standards (except those of Americans) — and Justin Trudeau’s Liberals have always believed that they owned the middle of the road. The 78-day election campaign, which was a tight three-horse race until the last couple of weeks, was not about ideology at all. It was about political style.

Stephen Harper didn’t do “nice.” His default setting was “nasty,” and he positively revelled in it. He was a control freak who instinctively tried to hurt and smear those who disagreed with him, and in his government even the time of day was a state secret. His attack ads against rival politicians were vicious, he was visibly contemptuous of journalists and the opposition parties and he almost took pride in being disliked.

In fact, Harper once joked that he couldn’t even get his friends to like him, but that was only a half-truth. He had no real friends in Canadian politics, even in his own Conservative Party. Yet, he stayed at the top of national politics for almost a decade because he actually ran a reasonably effective government that shielded Canadians from the worst effects of the post-2008 recession. His manner was unpleasant, but he was no radical.

What finally defeated Harper was the fact that enough Canadians had grown sick of the nastiness that they were willing to vote for whichever party had the best chance of beating him. At the beginning of the election campaign that looked likely to be the New Democratic Party, but a typical piece of Harper nastiness took them down.

The great niqab debate was what did the New Democratic Party in. Only two Canadian Muslim women have ever insisted on wearing the face-covering during a citizenship ceremony, but the Conservatives turned banning niqabs into a “wedge issue” — and New Democratic Party leader Thomas Mulcair said Muslim women should be allowed to wear them.

So did the Liberal leader, actually, but it didn’t hurt Trudeau because identity politics is not a big thing in most parts of Canada. It’s a huge thing in French-speaking Quebec, where the politics has been mostly about Quebec nationalism and separatism for two generations. Rival identities are not welcome in such an environment — and almost half the New Democratic Party’s seats were in Quebec.

Eighty percent of Quebecers wanted to ban the niqab, and when Mulcair said he opposed a ban the party’s support there collapsed. A typically nasty piece of political manipulation, but in fact the Conservatives had been too clever. Previously undecided voters whose only objective was getting rid of Harper swung behind the Liberals when they appeared to be the only party that could do the job.

Harper might still be in office today if he had just let the two opposition parties split the anti-Harper vote evenly between them. There are times when nastiness just doesn’t pay.

In the end Trudeau won just by being sunny, positive and nice. He talked a great deal about “change,” because that was what the anti-Harper voters wanted to hear, but he didn’t go into much detail.

Trudeau promised a few flagship policy changes to get people’s attention — pulling Canadian warplanes out of Iraq and Syria, slightly higher taxes for the rich and slightly lower taxes for the middle class, maybe legalizing marijuana — but his core social and economic policies aren’t going to be radically different from Harper’s. They can’t be because otherwise he’d have to leave the middle of the road.

He will, however, be much nicer than Harper.

Gwynne Dyer is a London-based independent journalist whose commentary is published in 45 countries.