Image caption After the American-led invasion of Afghanistan in 2001, thousands of Afghans sought refuge in Iran

It is difficult to believe that there is an operational alliance between Iran, a hard-line Shia Muslim state, and al-Qaeda, an extremist Sunni Muslim outfit.

Al-Qaeda and the Taliban do not even regard Shias as Muslims. The two sides regard each other as a low-priority enemies.

But all indications point to the presence of a number of senior al-Qaeda figures in Iran - albeit under house arrest or at least some form of restrictions on their movements.

Their story goes back to 2001: in the last months of that year, when American forces and their Afghan allies, the Northern Alliance, were heading towards Kabul to overthrow the Taliban government, the Iranian government under then-President Mohammad Khatami opted to support the Northern Alliance.

But Iran's Supreme Leader Ali Khamenei was worried about having American troops on his country's doorstep - on its eastern border.

He sent emissaries to Kandahar, the stronghold of the Taliban, to open a line of communication and to offer some help.

But it was already too late. The Taliban didn't need arms or money; they needed a safe way out of Afghanistan. And Iran agreed to provide that.

Bin Laden family

In November 2001 as a television reporter for CNN, I visited an Afghan refugee camp in the no-man's land just beyond the Iranian border with Afghanistan.

Canada train 'terror plot' Plot to allegedly derail train on VIA Rail network, which carries nearly four million passengers annually

Suspects not Canadian nationals but were in Canada legally

Chiheb Esseghaier studying for doctorate at National Institute for Scientific Research near Montreal

Reports say Raed Jaser is a customer service representative at a removal firm

It had just been set up by Iranians as a way of helping the thousands of refugees who were heading towards Iran, fearing war in their own country.

Most of the thousands of families that had arrived already seemed to be the supporters of the Taliban. The camp even had Taliban fighters as guards.

At the camp we came face to face with a group of freshly dressed Islamic figures who had come to the camp from the Iranian side to inspect, and who tried to avoid being filmed.

It turned out that they had come to sift through the refugees, identify senior al-Qaeda figures and help them across the border.

During this period, Iran allowed in hundreds of senior figures of the Taliban - including family members of Osama Bin Laden.

These included at least one of his wives, two sons - Khalid, who was killed with Bin Laden in the 2011 US raid on Abbottabad, and Saad, who was killed in 2009 - and one daughter, Iman.

Other senior al-Qaeda figures who entered Iran include:

Suleiman Abu Gaith, a Kuwaiti national and Bin Laden's son-in-law, who fled to Turkey last month

Saif al-Adel, an Egyptian national and head of al-Qaeda's security committee

Mohammad al-Masri, who is said to be the mastermind behind the 1998 bombing of US embassies in East Africa

But they all soon found themselves hostages of the Iranian government, which decided to place the most important of the arrivals under house arrest, and others in jails in southern Iran.

Iran had changed its tune and was looking at its hostages as bargaining chips.

By all accounts, the hostage situation has continued to this day, although many of the hostages have been either extradited to their countries of origin or simply allowed to leave.

Huge liability

Image caption The suspects in the Canada bomb plot allegedly planned to derail a train in the greater Toronto area

In 2003, it was reported that Iran had offered a deal to the US administration: it was prepared, the report said, to exchange some of these senior al-Qaeda figures for the imprisoned leaders of an Iranian-armed opposition group in Iraq, the Mujahideen Khalq Organisation (MKO).

In 2010 Bin Laden's teenage daughter escaped from her house arrest in Tehran to take refuge in the Saudi embassy. She was eventually allowed to leave Iran - but not before an Iranian diplomat, Heshmatullah Attar-zadeh Niaki, who had been kidnapped in Pakistan, was set free.

By all accounts, there are still a number of senior al-Qaeda figures in Iran today.

It is possible that even under the restrictions imposed on them by the Revolutionary Guards and Iran's myriad intelligence agencies, some may have been active in establishing contacts with the al-Qaeda network - and even helping to raise funds abroad and provide assistance and guidance to members, without the knowledge of the Iranian authorities.

What is clear is that the presence of senior al-Qaeda figures has now turned into a huge liability for the government of Iran.