Media playback is unsupported on your device Media caption Assistant Commissioner James Malizia: "Innocent people would have been killed or seriously injured"

Two foreign men living in Canada have been charged with plotting a terrorist attack on a passenger train with support from al-Qaeda elements in Iran.

The authorities say suspects Chiheb Esseghaier, 30, and Raed Jaser, 35, were arrested in Montreal and Toronto on Monday.

They allegedly planned to derail a passenger train in the greater Toronto area, but it is not clear when.

Iran has denied any link to the suspects being held in Canada.

Iranian foreign ministry spokesman Ramin Mehmanparast told a press conference that the politics of extremists did not conform with those of Iran.

He accused Canada of following an "Iranophobic" project over the past few years.

The two suspects will appear in court on Tuesday for a bail hearing.

Analysis As a militant Salafist Islamic movement, al-Qaeda preaches a radical anti-Shia ideology that places it firmly at odds with Shia Iran. In Afghanistan, Iraq and Syria, al-Qaeda has warred with factions and ethnic groups it considers close to Iran. Despite this enmity, al-Qaeda and Iran have tolerated one another where it suited them. After the defeat of the Taliban in Afghanistan, Tehran allowed several top al-Qaeda associates - including one of Osama Bin Laden's wives and several of his children - to live under so-called "house arrest" in eastern Iran. More recently, Iran has expelled the most senior of those al-Qaeda officials, including Bin Laden's son-in-law Sulaiman Abu Ghaith. US officials say the tougher stance reflects growing tension between Iran's Shia clerics and the Sunni militant group, particularly over the civil war in Syria. That may explain why the Royal Canadian Mounted Police have been quick to point out that investigators have seen no evidence Iran backed this plot.

The Royal Canadian Mounted Police (RCMP) said the surveillance operation leading to the arrests was "a result of extensive collaborative efforts".

It said that FBI agents from the US were involved in helping to foil the attack.

The RCMP said the two men were not Canadian citizens and were supported by "al-Qaeda elements in Iran" although there was no evidence of state sponsorship.

Their plan was to derail a train operated by VIA Rail and "kill and hurt people".

RCMP Chief Superintendent Jennifer Strachan said the attack was "definitely in the planning stage but not imminent".

"We are alleging that these two individuals took steps and conducted activities to initiate a terrorist attack," she said.

"They watched trains and railways in the Greater Toronto area."

Chief Supt Strachan did not say if the route being targeted was a cross-border route with the US.

RCMP Assistant Commissioner James Malizia said: "Each and every terrorist arrest the RCMP makes sends a message and illustrates our strong resolve to root out terrorist threats and keep Canadians and our allies safe."

VIA Rail, which operates passenger rail services across Canada, said that "at no time" were passengers or members of the public in imminent danger.

There was no connection between the plot and last week's Boston Marathon bombings, a US justice department official was quoted as saying by the Associated Press news agency.

Canadian Public Safety Minister Vic Toews said the arrests showed that terrorism continued to be a real threat to Canada.

"Canada will not tolerate terrorist activity and we will not be used as a safe haven for terrorists or those who support terrorist activity," he said in parliament.