Charles Court was the last man out. As chargé d'affaires, he was Canada's senior diplomat in Iran, so it fell to him to turn out the lights.

Court surreptitiously took down the flag and slipped out onto the streets of Tehran.

That was one year ago — but only now will sources reveal to CBC News, anonymously, how Canada managed to surprise the world with its sudden, secret departure from Iran.

It's a cloak-and-dagger tale, with a heavy cloak over the plan to sneak the diplomats out unnoticed — and a sharp dagger through the hard drives they left behind.

Those hard drives held clues to the identity of Iranian contacts. Even an innocent visa application could attract suspicion in the eyes of the Iranian secret police. Everything had to be destroyed, and just hitting "delete" wouldn't cut it.

A former top CSIS officer who served abroad, Ray Boisvert, told CBC News the diplomats would have to "physically destroy any hardware that contains any data." Typically, that can be done with a hammer — or, even better, a drill.

"Be it CDs, be it thumb drives, hard drives — everything has to be physically destroyed, because erasing does not work. There are always ways to recoup information."

No word until they're all out

In this case, according to sources, the hard drives were smashed discreetly — on the weekend, so local embassy staff wouldn't notice. And Canada's eight diplomats, led by Court, booked separate flights to different destinations, so as not to attract attention.

Back in Ottawa, national security adviser Stephen Rigby and Mark Bailey at Foreign Affairs burned some midnight oil as they watched the plan unfold. No announcement was made until the prime minister got the call saying, they're all out.

Harper got that call en route to the APEC summit in Vladivostok, Russia. A few minutes after midnight there, Foreign Minister John Baird broke the news: Canada had already shuttered its embassy and was cutting off diplomatic relations with Iran — whose diplomats would be kicked out of Canada forthwith.

Or, they would be, if they could be found.

There was a snag on the Ottawa end. How can someone be kicked out if he doesn't know about it? Officials tried repeatedly to reach Iran's chargé d'affaires, Kambiz Sheikh-Hassani, on his cellphone to give him the bad news. No answer.

Finally, they sent a staffer to the Iranian Embassy on Metcalfe Street in Ottawa and stuck a notice on the door telling the diplomats they had five days to get out of Canada. Sheikh-Hassani protested to the CBC's Peter Mansbridge that it was "uncivilized" — and it was, perhaps, not the most elegant end to their posting in a cold country. But it was certainly a surprise.

Getting the boot in first

A year later, in Russia again — this time for the G20 summit — Baird let slip one of the reasons for all the secrecy. Yes, he'd been concerned about the safety of his team in Tehran if word leaked out. But, he said, "frankly, we didn't want them to discover what our actions would be and then try to expel us before we could expel them."

So, getting the boot in first was important. But even Canada's allies were surprised by the sudden exit — so much so that the Harper government had to tamp down speculation that it had some inside knowledge of a pending Israeli attack on Iran.

Staff back a van into the underground garage at the Iranian Embassy in Ottawa on Sept. 7, 2012, after Canada gave Iranian diplomats five days to leave the country. (Fred Chartrand/Canadian Press)

Of course, it wasn't the first time Canada had pulled a surprise in Iran. They made a Hollywood movie about the first time — when the Canadians, led by Ambassador Ken Taylor, famously smuggled six American diplomats out of Tehran in the midst of the hostage crisis in 1980.

This time, Canadian officials insist that lives were, again, in the balance. Baird told reporters in St. Petersburg on Thursday that "we had substantial concerns about the security and the safety of our staff."

Boisvert, the former CSIS officer, said that makes sense, given the history.

"People would have been used, perhaps, as pawns. And, if the Iranian regime would have been made aware of the event in advance, they perhaps would have gone and — as they've done in the past — seized diplomats and others to further their interests."

Burning our bridges?

Not everyone thinks that's plausible.

"That circumstance certainly didn't present itself to me when I was the Canadian ambassador to Iran," said the last man to hold that job, John Mundy.

"We had a very troubled relationship with the Iranian government, but we felt, for the most part, we felt physically safe in the country despite the fact that relations were not only bad but getting worse."

Mundy, now retired, was booted out of Iran during another diplomatic low point, in 2007. Both countries then downgraded their embassies to be run by chargés d'affaires. Still, Mundy told CBC News, the government did the right thing then by keeping the embassy open — and blundered this time by closing it completely.

"We have for all intents and purposes burned our bridges" to Iran, he said.

"We've said further dialogue with Iran is pointless. So, it's fair to ask your own government, if you think talking to Iran is pointless, how then do you see a resolution of the nuclear issue without actual confrontation?"

"With Britain gone, with the United States gone for decades from Iran, the diplomatic reporting that Canadian diplomats undertook in Iran was valuable both to the Canadian government … and to our closest friends and allies, like Britain and the United States."

But the government wanted to go all the way — and the plan to keep it secret worked. Ottawa did manage to give Iran's diplomats the boot before they did the same to ours.

Getting back in, though, won't be easy. After the 1980 caper, it took 10 years.