Canadian authorities claim al-Qaida operatives in Iran directed a failed plot to attack a passenger train. Iran denies it has any links to the two suspects. What falls in between is Iran's complicated history with the terror group that has included outright hostility, alliances of convenience and even overtures by Tehran to assist Washington after the Sept. 11, 2001, attacks.

Q: Are Iran and al-Qaida allies?

A: Relations have always been rocky. Iran has been at odds with al-Qaida on many fronts. A fundamental divide is over the two main branches of Islam. Iran is mostly Shiite. Al-Qaida is nearly exclusively Sunni-led. Some hard-line militants backing al-Qaida consider Shiite Muslims as heretics and view Tehran's regional ambitions as a greater threat than the West. Sunni insurgents in Iraq, for example, have used car bombs and suicide attacks against Shiite targets, killing thousands since 2003. In January 2011, the al-Qaida faction in Yemen declared "holy war" against Shiite rebels that are believed supported from Tehran. Iran also has been incensed by al-Qaida backing for Syrian rebels seeking to overthrow the regime of Bashar Assad, one of Tehran's main allies in the region. Before the 9/11 attacks, Iran was even more outspoken than Western countries against the Taliban, which sheltered Osama bin Laden and other al-Qaida leaders. In 1998, eight Iranian diplomats were killed when Taliban forces overran Mazar-i-Sharif in northern Afghanistan and were accused of the systematic slayings of Shiites. The rights group Amnesty International said Taliban fighters stormed the Iranian consulate as part of its anti-Shiite purges. A June 2009 al-Qaida memo – possibly to bin Laden – refers to the Iranian government as "criminals" and bashed its opaque and unpredictable policies. The document was among files seized in the May 2011 raid that killed bin Laden and was posted online last year by the U.S. Army's Combating Terrorism Center.

Q: How did al-Qaida figures end up in Iran?

A: After the U.S.-led attacks against the Taliban in late 2001, scores of al-Qaida foot soldiers, leaders and some of bin Laden's relatives fled over the border into Iran. Iran put many under house arrest-style detention, but refused to send them to U.S. allies, such as Saudi Arabia, where they could face extradition or interrogations by American forces. Tehran's leadership believed that holding bin Laden relatives and al-Qaida officials could offer a guarantee against anti-Shiite attacks. It also was seen as an unexpected bargaining chip with the West for Tehran's leadership, which rejoiced in the Taliban's downfall but was fearful of U.S.-led forces next door.

Q: Who were among the high-level al-Qaida operatives in Iran?

A: Al-Qaida's senior military strategist Saif al-Adel was in Iran for years with his family. He was under close surveillance, but apparently received more freedoms to travel abroad and have greater contacts as part of a deal in 2010 to free a kidnapped Iranian diplomat in Pakistan's tribal areas, where al-Qaida still carries strong influence. It's unclear whether he remains in Iran or has shifted to other areas, possibly Pakistan. Several reports he was killed have not been verified in recent years, but speculation continues to be fueled by a lack of confirmed sightings or statements. Al-Adel, an Egyptian, allegedly helped mastermind the 1998 bombings of U.S. embassies in Africa and is among the FBI's most-wanted terrorists. Another top al-Qaida official, bin Laden son-in-law Sulaiman Abu Ghaith, lived in Iran for about a decade, according to U.S. investigators. Abu Ghaith – a Kuwaiti stripped of his citizenship by the Western-allied Gulf nation – was captured by the FBI in Jordan in February and would be the highest-ranking al-Qaida figure to stand trial on U.S. soil since 9/11. He served as al-Qaida spokesman and fundraiser before the group's leaders fled Afghanistan and possibly continued some work from Iran, security analysts say. Abu Ghaith also was given more freedoms to travel outside Iran in the deal to free the Iranian diplomat.

Q: Could al-Qaida operatives in Iran have a role in coordinating an attack in the West without Tehran's knowledge?

A: In the past, Iran kept a very close eye on all al-Qaida figures in the country. Iranian intelligence services had access to all communications and contacts. The apparent loosening of restrictions following the diplomat-release deal, however, raises new questions. They include whether al-Qaida operatives in Iran could now make trips outside the country to places such as neighboring Pakistan or Iraq to make connections with the wider terror network. Also, Iranian officials are increasingly focused on economic troubles from international sanctions over Tehran's nuclear program. Keeping watch over the al-Qaida remnants in Iran may no longer have the same priority.

Q: Did Iran help the West in efforts to identity al-Qaida fugitives?

A: To some extent, yes. In 2003, Iran gave the U.N. Security Council the names of 225 al-Qaida suspects detained after illegally crossing into Iran and deported to their countries in the Middle East, Europe and Africa. Earlier, Iran had rounded up hundreds of Arabs who had crossed the border from Afghanistan. Most were expelled, but not before Iran made copies of nearly 300 passports and other documents in an apparent effort to help the U.S.-led efforts to track the al-Qaida networks after 9-11. Iran's offers of cooperation with Washington came to a halt after being named in 2002 as part of President George W. Bush's "axis of evil."

Q: What about bin Laden's family members in Iran?

A: One of bin Laden's wives and several children and grandchildren. Early in 2010, one of bin Laden's daughters, Iman, managed to flee one of the compounds in Iran to reach the Saudi Embassy in Tehran. She was eventually allowed to leave Iran to resettle in Syria. The same year, one of bin Laden's sons, Khalid, dispatched a letter to Iran's Supreme Leader Ayatollah Ali Khamenei claiming that his relatives were mistreated and "beaten and silenced." Khalid was among those killed in the U.S. raid on bin Laden's compound in Pakistan.

Also on HuffPost:

Loading Slideshow...
  • Osama Bin Laden

    Al Qaeda's longtime leader <a href="http://www.huffingtonpost.com/2011/05/01/osama-bin-laden-dead-killed_n_856091.html" target="_hplink">was killed</a> in an American raid on his compound in the Pakistani city of Abbottabad on May 1, 2011. (AP Photo, File)

  • Ayman al Zawahri

    Ayman al Zawahri became <a href="http://www.foxnews.com/us/2012/04/29/5-most-wanted-al-qaida-leaders/" target="_hplink">al Qaeda's new leader</a> after the death of Osama bin Laden. He is believed to be hiding in Pakistan and regularly releases propaganda videos. (AP Photo/SITE Intel Group)

  • Abu Yahia al Libi

    Abu Yahia al Libi was al Qaeda's <a href="http://www.huffingtonpost.com/huff-wires/20120429/us-al-qaida-top-5/" target="_hplink">de facto no. 2</a> after the death of Bin Laden. He escaped a high-security U.S. prison in Bagram, Afghanistan, in 2005. Al Libi <a href="http://www.huffingtonpost.com/2012/06/05/abu-yahia-al-libi-drone-strike_n_1569772.html" target="_hplink">was killed</a> in a drone strike in Pakistan in June 2012. (AP)

  • Nasser al Wahishi

    Al Wahishi was once bin Laden's <a href="http://www.huffingtonpost.com/huff-wires/20120429/us-al-qaida-top-5/" target="_hplink">aide-de-camp</a> and now commands AQAP, al Qaeda's affiliate in the Arabian Peninsula. (AFP/GettyImages)

  • Ibrahim Hassan al Asiri

    Saudi Ibrahim Hassan al Asiri is <a href="http://www.huffingtonpost.com/huff-wires/20120429/us-al-qaida-top-5/" target="_hplink">believed to be responsible </a>for building the underwear bomb used to try to bring down a Detroit-bound jetliner on Christmas 2009, as well as the printer-cartridge bombs. (AP)

  • Said al Masri

    Al Qaeda's no. 3 was <a href="http://www.huffingtonpost.com/2010/05/31/al-qaeda-number-three-reported-killed_n_595561.html" target="_hplink">killed</a> in an American drone strike in May 2012. (Reuters TV)

  • Fazul Abdullah Mohammed

    Mohammed, who led the organization in Eastern Africa, was <a href="http://www.huffingtonpost.com/2011/06/11/fazul-abdullah-mohammed-dead_n_875363.html" target="_hplink">killed</a> by the Somalian army in June 2011. (AP)

  • Abu Musab al Zarqawi

    Al Qaeda's brutal leader in Iraq was <a href="http://www.huffingtonpost.com/2010/04/19/two-top-al-qaeda-figures-_n_542653.html" target="_hplink">killed</a> in a U.S. airstrike in 2006. (AP Photo/U.S. Department of State, HO)

  • Khalid Sheikh Mohammed

    Khalid Sheikh Mohammed, the <a href="http://www.huffingtonpost.com/2012/05/06/khalid-sheikh-mohammed-trial_n_1489527.html" target="_hplink">self-described mastermind</a> of the attacks of 9/11, was <a href="http://www.bbc.co.uk/news/world-12964158" target="_hplink">captured in Pakistan in March 2003</a> and is currently being held at Guantanamo Bay. (AP Photo/FBI) <em><strong>CORRECTION:</strong> An earlier version of this slide misstated the date of Sheikh Mohammed's capture.</em>

  • Saif al Adel

    Al Adel was Bin Laden's former <a href="http://www.huffingtonpost.com/huff-wires/20120229/ml-egypt-arrest/" target="_hplink">security advisor</a>. He is still on the run. (Getty Images)

  • Adnan el Shukrijumah

    Adnan El Shukrijumah is reportedly responsible for al Qaeda's external operations. He <a href="http://www.huffingtonpost.com/2010/08/06/adnan-shukrijumah-new-al_n_673164.html" target="_hplink">lived in the U.S.</a> for more than 15 years. (FBI)

  • Atiyah Abd al Rahman

    Al Rahman was al Qaeda's liaison for Iraq, Iran and Algeria until he <a href="http://www.huffingtonpost.com/2011/08/27/atiyah-abd-al-rahman-al-qaeda-dead_n_939009.html" target="_hplink">was killed</a> on August 22, 2011 in Pakistan. (AP Photo/National Counterterrorism Center)