A political leader's success or failure comes down to three main variables: what the politician does, what the politician's opponents do, and what the gods do.

The lesson from last week is to never overlook the third variable. Sometimes, fate is the major player.

Many of us had settled on the notion that unless something shocking happened, Prime Minister Stephen Harper's image, after so long in power, was set.

Story continues below advertisement

Something shocking? How about the trauma of terror at a nation's core. We remember how prime minister Pierre Trudeau's popularity soared during the October Crisis. We remember how U.S. president George W. Bush vaulted to 90 per cent after the attacks of Sept. 11, 2001. It's the rally-around-the-flag effect.

There's no certainty that the attack on Parliament Hill, while no 9/11, will engender a big popularity bounce for the Prime Minister. It may be short in duration, but patriotism is overflowing in this land right now. In times like these, people want a strongman. Security becomes a top-drawer issue. It all plays perfectly to the politics of Mr. Harper, who is being lauded for his handling of the crisis.

In contrast with the honouring of Corporal Nathan Cirillo, flags weren't flown at half-mast for fallen soldiers returning from Afghanistan – Mr. Harper's government imposed a media ban on repatriation ceremonies.

Political considerations are different now. The Prime Minister needed something to buttress his case for joining the air combat mission against Islamic State and for saying Canada was a terrorist target – then, in the space of two days, came the attacks in Quebec and Ottawa.

The fates aligned with the Prime Minister's political needs – and hardly for the first time. Opposition members don't like to talk about it because it sounds like sour grapes, but they shake their heads at how often timing has worked in his favour.

Mr. Harper's sabre-rattling foreign policy extended to Russia, where he warned that Vladimir Putin was a grave threat. Something to back up his talk would make him look good, prescient even. On cue, Mr. Putin moved on the Ukraine.

After yet another Arctic tour this summer to stake out sovereignty in the North, some sign of tangible progress would have been helpful. On cue, the Franklin shipwreck was discovered, bolstering Canada's claim to the Northwest Passage.

Story continues below advertisement

Early this year, the Quebec election began to look very worrisome, with a triumph by the separatists looking likely. They got clobbered. Also very troubling was the prospect of Mr. Harper's former chief of staff, Nigel Wright, being charged in connection with the Senate scandal. No charges came.

Opponents preparing for the next election might pause to wonder how the fates have performed for Mr. Harper during previous campaigns.

In 2006, he was trailing when out of the blue came the news that the RCMP had launched a criminal investigation of the Liberals on income trusts. It turned the tide.

In the 2008 election, as he was losing momentum in the closing days, Liberal leader Stéphane Dion made his infamous language stumble to begin an interview. Momentum shifted. And Tories will tell you what a boost they got, given their law-and-order agenda, from the stunning news that Osama bin Laden had been killed in the last hours of the 2011 campaign.

The PM's tactical skills can be daunting. As can be the hands of fate.

Remember the 2008 coalition crisis, when even Mr. Harper himself thought he was finished? The Liberals revived him by rolling out separatist Gilles Duceppe as a member of their coalition team. The Governor-General could have brought Mr. Harper down anyway, but granted his wish for prorogation. The opposition parties then forced his hand in bringing in a big economic stimulus program, for which Mr. Harper subsequently got much credit.

Story continues below advertisement

Timing? When a major national protest against his second prorogation of Parliament was set to take place, the horrific Haiti earthquake moved it to the back pages. Timing? When Mr. Harper was stumbling in his early days as opposition leader, lo and behold came the Liberal sponsorship scandal to revive him.

There's a phrase in Latin, deus ex machina. In our politics, its relevance is not to be underestimated.