OTTAWA -- The federal government is creating a new mechanism to warn Canadians if malicious actors try to manipulate the outcome of this fall's election.

It is establishing a "critical election incident public protocol," under which five senior public servants will decide when an incident is egregious enough to warrant going public in the midst of a campaign.

The protocol is intended to avoid the dilemma that faced James Comey, the FBI director during the 2016 U.S. presidential campaign, when he was confronted with evidence of Russian interference apparently aimed at boosting Donald Trump.

With no rules for dealing with such a situation, Comey decided not to reveal the interference during the campaign.

The five public servants who will be charged with determining what should be revealed during a Canadian federal campaign are: the clerk of the Privy Council, the government's national security adviser, and the deputy ministers of justice, public safety and global affairs.

"Nothing is more important to this government than protecting our democracy and ensuring the next election is fair and free," Defence Minister Harjit Sajjan said in a news conference Wednesday, alongside Public Safety Minister Ralph Goodale and Democratic Institutions Minister Karina Gould.

Officials say the threshold will be high: only disruptive incidents that harm Canada's ability to hold a free and fair election will be publicly disclosed.

The protocol will apply to either domestic or foreign actors who launch cyberattacks or use orchestrated disinformation campaigns through social media to undermine the integrity of an election.

Gould has begun discussions with social media companies to increase the transparency of political advertising and to prevent manipulation of their platforms for anti-democratic purposes, according to the government’s website.

“The government of Canada expects that social media companies will proactively apply the latest advancements and most effective tools from around the world,” the website says. “Canadians should not have to wait to benefit from new resources employed in other countries.”

Officials say there is no intention to police routine political spin during a campaign.

The protocol will apply only during the official campaign, known as the writ period. Outside the writ period, national-security agencies will inform the prime minister and minister of democratic institutions of any interference and it will be up to them to decide what to disclose publicly.

Sajjan said the Canadian government has been working with other G7 countries worried about their own elections to come up with joint plans for monitoring and dealing with foreign threats such as hackers trying to break into election systems.

With files from BNN Bloomberg