Two men were arrested and charged with plotting a terrorist attack against a Canadian passenger train with support from al-Qaida “elements” in Iran, police said Monday.

Chiheb Esseghaier, 30, and Raed Jaser, 35, who live in Montreal and Toronto, were planning to derail a Via Rail passenger train in Toronto but posed no immediate threat, the Royal Canadian Mounted Police said.

“This is the first known al-Qaida planned attack that we’ve experienced in Canada,” Superintendent Doug Best said.

RCMP Assistant Commissioner James Malizia said the two men had “direction and guidance” from “al-Qaida elements located in Iran,” though there was no reason to think the planned attacks were state-sponsored. Police said the men did not get financial support from al-Qaida, but declined to provide more details.

“It was definitely in the planning stage but not imminent,” RCMP chief superintendent Jennifer Strachan said. “We are alleging that these two individuals took steps and conducted activities to initiate a terrorist attack. They watched trains and railways.”

Strachan said they were targeting a route, but didn’t say if it was a cross border route.

Bruce Riedel, a CIA veteran who is now a Brookings Institution senior fellow, said al-Qaida has had a clandestine presence in Iran since at least 2001 and that neither the terror group nor Tehran speak openly about it.

“The Iranian regime kept some of these elements under house arrest,” he said in an email to the Associated Press. “Some probably operate covertly. AQ members often transit Iran traveling between hideouts in Pakistan and Iraq.”

Charges against the two men include conspiring to carry out an attack and murder people in association with a terrorist group. Police said the men are not Canadian citizens, but declined to say where they were from or why they were in the country.

They had been in Canada “a significant amount of time.” He would not say how long, but said they had been under investigation since last fall.

Authorities were tipped off about one of the suspects by members of his community, said Best, who would not specify which community.

The investigation was part of a cross-border operation involving Canadian law enforcement agencies, the FBI and the U.S. Department of Homeland Security.

There is no connection between the Canadian terrorist plot and the Boston Marathon bombings, said a U.S. Justice Department official in Washington.

Strachan said the two men will attend a bail hearing in Toronto today.

A spokeswoman for the University of Sherbrooke in Montreal said that Esseghaier studied there in 2008-2009. More recently, he has been doing doctoral research at the Institut national de la recherche scientifique, a spokeswoman at the training university confirmed. A Linked In page says a man with Esseghaier’s name and academic background helped author a number of biology research papers, including on HIV and cancer detection. The page carries a photo of a black flag inscribed with the Islamic declaration of faith.

The arrests just a few months after two Canadians were found among militants killed in a terrorist siege at a gas plant in Algeria. The siege killed at least 38 hostages and 29 militants, including Ali Medlej and Xristos Katsiroubas, two high school friends from London, Ontario.