Bessma Momani is full professor at the University of Waterloo and senior fellow at the Centre for International Governance Innovation.

Just a month ago – it feels like longer – 57 Canadians were killed when Ukraine International Airlines Flight 752 was downed near Tehran by what was later revealed to be an Iranian surface-to-air missile. It was a tragedy that Iran admitted to causing but for which it has yet to take full responsibility.

And so when a photo and video circulated on social media of Prime Minister Justin Trudeau shaking the hands of a smiling Iranian Foreign Minister Javad Zarif on the sidelines of the Munich Security Conference last week, it was proudly promoted on Iranian television.

Story continues below advertisement

This was a diplomatic coup for the Iranian regime. A leader of the liberal world order, shaking hands with a representative of a regime responsible for killing so many people, offering Iran a chance to claim a foreign-policy win at a time of continued international isolation, painful U.S.-imposed economic sanctions and internal protests calling for the removal of Supreme Leader Ali Khamenei.

But we must remember that in this moment, Canada got the mechanics of diplomacy right, yet it failed royally in the optics.

Undoubtedly, this is an awkward and delicate situation. Diplomacy and bilateral meetings with unsavoury governments are sometimes needed to get international affairs done, and ironically it can be even more crucial to undertake such efforts with rogue and unpredictable regimes to avoid a wider escalation of conflict. Indeed, the practice of diplomacy is not an approval of another government’s behaviour; it is a necessary tool of statecraft to achieve one’s national interest.

So while the Iranian regime has no shortage of blood on its hands, bilateral meetings are unavoidable if Canada wants to pursue justice for the families of those who were killed by negotiating the repatriation of remains, getting fair financial compensation for families, pushing for an independent and transparent investigation of the tragedy and demanding that Iran turn over the flight’s black boxes to a competent and technical body for analysis. These efforts have been only further complicated by the fact that Ottawa has not had formal diplomatic ties with Tehran since 2012. But Canada had been successful thus far in this careful dance; its persistence in exposing the truth behind the downing of the passenger plane through quiet diplomacy and its non-bombastic tone had effectively pressured Iran into admitting it had shot down the plane.

That said, diplomacy is also about tactfulness, understanding the art of symbolism and showing necessary discretion. Optics are the secondary component of smart diplomacy. Thus, allowing Mr. Trudeau to be photographed by Iranian press with a smiling Mr. Zarif – rather than having a private meeting – was all wrong. The photo is another feather in the cap of the Iranian regime, and it was not in our interest. This was a public-relations blunder for Canada.

This isn’t the first time Canada has fumbled on the balance between mechanics and optics. In 2012, then-prime minister Stephen Harper decided to close Canada’s embassy in Tehran, but that was not an act that actually punished Iran; Ottawa only made life more difficult for Canadians of Iranian heritage to take care of their family affairs in Iran, to get important consular services and to receive vital emergency services and legal protections from the Canadian government. In short, Mr. Harper’s government chose to favour optics at the expense of many Canadians’ interests.

Our diplomatic activities should not cease tomorrow because the world is an uglier place, but the importance of optics cannot be ignored. The Munich conference followed Mr. Trudeau’s tour of Africa, where he worked to promote Canada’s bid for a United Nations Security Council seat, and this unfortunately meant he was photographed with leaders who do not share our values, have jailed scores of political prisoners and thumbed their noses at our vision of inclusion.

Story continues below advertisement

We will need to learn many lessons from this particular moment in time, especially as the list of unsavoury governments, autocratic dictators and elected xenophobes grows. We cannot let dictators, despotic regimes and illiberal democratic leaders control the narrative and shape the optics of our diplomatic engagement. Our diplomacy should be used as a megaphone for positive change and, as best we can, hold unscrupulous governments to account – remembering that many people across the world are looking to Canada to speak up against the injustices happening at the hands of their illiberal governments.

Keep your Opinions sharp and informed. Get the Opinion newsletter. Sign up today.