Stephen Harper speaks during an election campaign stop at Global Systems Emissions Inc., in Whitby, Ont., on Oct. 6, 2015. (Nathan Denette / THE CANADIAN PRESS)

Before Russian internet trolls tried to influence the outcome of the 2016 U.S. presidential election, they were already using social media in an attempt to sway voters in Canada.

That's according to a new study from Simon Fraser University, which details the ways both Russian and Iranian trolls spread disinformation on Twitter in the lead-up to the 2015 Canadian election won by Prime Minister Justin Trudeau.

Study author Ahmed Al-Rawi said the separate campaigns were designed to disparage candidates on different sides of the political spectrum, and, more generally, to sow division among the Canadian electorate.

"These trolls know what they are doing," said Al-Rawi. "It seems they've studied Canadian culture and society well, and they know exactly who to target."

While the federal government has acknowledged "low-sophistication cyber threat activity" targeting the 2015 election, Al-Rawi's study boasts new details and insights into the campaigns.

His research is based on data sets publicly released by Twitter comprising tweets from identified troll accounts. Al-Rawi searched more than 12 million tweets for dozens of Canada-specific keywords, such as "Calgary," "Vancouver," "Trudeau" and "Harper," then looked for patterns.

What he discovered was that state-backed Russian trolls aligned with incumbent prime minister Stephen Harper and the Conservative party, while Iranian trolls aligned with Trudeau and the Liberals.

"For the Russians, they showed great animosity against immigrants, refugees, politicians from visible minority groups and Liberals, because of their stance towards immigration," Al-Rawi said.

According to the study, those attacks on immigrants continued well after the 2015 election as well. Russian trolls allegedly helped spread the false claim that the 2017 mosque shooting in Quebec City was actually an "inside job" by Muslims. The real perpetrator, Alexandre Bissonnette, is a white man with reported far-right and white nationalist views.

Meanwhile, the study found Iranian trolls had amplified a fake story that Stephen Harper was actually a CIA plant who couldn't be trusted. Al-Rawi noted that most of those tweets were written in French, in an apparent attempt to influence voters in Quebec.

The author suggested Russians favoured Harper because their governments were more alike, while Iranians favoured Trudeau because he was perceived as pro-immigration and more open to fostering a relationship with Iran.

Sometimes the falsehoods would be reported on state-sponsored news websites so that trolls could share the links on social media, giving them an air of legitimacy, Al-Rawi said.

"They're creating this whole information system where they would be able to manufacture reality in the way they want," he added. "It's completely false, a fabrication – but of course, people don’t usually cross-check information."

Al-Rawi said his research was peer-reviewed by four academics before being published in the journal Digital War. He believes there's no doubt there was an attempt at foreign interference in the 2015 election, but the burning question – which might never be answered – is whether the trolls had any impact at all on the results.

"They try to agitate people, try to make them feel upset," Al-Rawi said. "Have they succeeded? No one knows. No one knows the answer to this."