Chiheb Esseghaier, 30, of Montreal, and Raed Jaser, 35, of Toronto, were arrested Monday morning.
Police said the suspects had been watching trains and railways in the Greater Toronto Area and were conspiring to derail a passenger train. They wouldn't say how the suspects allegedly planned to attack, but said the plot had the "direction and guidance" from al-Qaida elements in Iran.
"This is the first known al-Qaida planned attack that we've experienced in Canada," said Supt. Doug Best.
There is no information to indicate the alleged plot was sponsored by the state of Iran, the RCMP added.
Dubbed "Project Smooth," the investigation was part of a cross-border operation involving Canadian law enforcement agencies, the FBI and the U.S. Department of Homeland Security.
"While the RCMP believed the accused had the capacity and intent to carry out these criminal acts, there was no imminent threat to the general public, rail employees, train passengers or infrastructure," RCMP Assistant Commissioner James Malizia said at a news conference.
Police had Esseghaier and Jaser under surveillance since August. They were put on investigators' radar thanks to tips from the Muslim community, Best said.
"The very first instance we were aware of the activities of one particular individual that yes, was brought to our attention by the community," he said.
About two dozen Muslim community leaders were called to meet with the RCMP and received a briefing before Monday's news conference.
They were told that one of the suspects is Tunisian and one is from the United Arab Emirates.
The suspects have been in the country legally for a "considerable period of time" but are not Canadian citizens, the RCMP said.
The two men are charged with conspiring to carry out an attack against, and conspiring to murder, persons unknown for the benefit of, at the direction of, or in association with a terrorist group.
Several U.S. media reports cited sources familiar with the investigation saying the alleged plot targeted a passenger train arriving in Toronto from New York City. Via Rail and Amtrak jointly operate trains between Canada and the U.S.
Via Rail said Monday it was co-operating with all parties involved to ensure the safety and security of its passengers, employees and the public.
"Thanks to an unprecedented co-operation between law enforcement and the security units of various departments, VIA Rail and CN, at no time was there an imminent threat to the VIA Rail passengers, employees or the general public," it said in a statement.
Meanwhile, Amtrak said in a statement that it is "aware of the ongoing investigation and will continue to work with Canadian authorities to assist in their efforts."
New York congressman Rep. Peter King praised Canadian authorities for the arrests.
"I commend our Canadian counterterrorism partners, particularly the Royal Canadian Mounted Police, for their efforts in stopping a major terrorist plot which was intended to cause significant loss of human life including New Yorkers," King said in a statement.
Police were carrying out search warrants at locations in Toronto and Montreal on Monday.
In Markham, Ont., north of Toronto, police tape cordoned off half a duplex, with officers remaining at the scene well into the night.
Sanjay Chaudhary, who lives in the other half of the duplex with his family, said RCMP questioned him about his neighbour, asking whether he knew him or spoke to him often.
Chaudhary said he didn't know his neighbour or the woman he believes is the man's wife but added "every day, we see them going out." He said the pair was already renting the unit when Chaudhary and his family moved in next door a year ago.
Monday's raid on the house stunned Chaudhary, who said the neighbourhood is otherwise "peaceful."
Canadian authorities declined to provide further details about the two suspects, but a spokeswoman for the University of Sherbrooke told The Canadian Press that Esseghaier studied at the institution 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.
"His thesis was on nanosensors and he was in one of our research centres," Julie Martineau said in an interview about the PhD student, who's enrolled in the faculty of energy materials and telecommunications.
"We are giving our full collaboration to the authorities regarding this story, so if they have questions for us, or if they need information, of course, they can count on our collaboration."
A man with the same name is scheduled to deliver a presentation on PSA cancer screening, with colleagues, at a conference in California this summer.
A LinkedIn 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. It also says the man studied the detection of influenza A virus during graduate research at the University of Sherbrooke.
The page carries a photo of a black flag inscribed with the Islamic declaration of faith.
The Muslim leaders who attended Monday's briefing with the RCMP were not surprised to hear that the original tip about the two suspects came from their community.
"I think now it's becoming more apparent to the Muslim community about its involvement with police services and with public safety agencies," said Kamran Bhatti, with North American Spiritual Revival, a Muslim cross-cultural community group.
The Muslim community is generally made up of law-abiding citizens who want to make a difference in their cities and towns, said Farina Siddiqui, with DawaNet, a Muslim outreach group.
"The partnership and collaboration between security agencies and the Muslim community is at a heightened level," she said.
"We need to work to identify the problems that our youth is getting into...then identify the solutions to actually eliminate those kinds of situations."
The arrests come only four months after two young 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, Ont.
Authorities said Monday the latest arrests were not related to the Algerian attack or last week's Boston Marathon bombings.
Other instances of so-called homegrown terror plots in Canada are few, but none of them were directed by al-Qaida.
Momin Khawaja was convicted in 2008 of training at a remote camp in Pakistan, providing cash to a group of British extremists and offences related to building a remote-control detonator.
A group of young Toronto-area men, who have come to be known as the Toronto 18, plotted to bomb several targets including the Toronto Stock Exchange, CSIS headquarters and a military base. Though 18 men were arrested, 11 were ultimately convicted of terrorism offences.
In August 2010, three Ontario men — Misbahuddin Ahmed and Hiva Mohammad Alizadeh of Ottawa, and Khurram Syed Sher, of London, Ont., — were arrested in a case known as Project Samossa. They are all charged with conspiring to facilitate terrorist activity.
In addition, Alizadeh and Ahmed face counts of making or having explosives and are also charged with participating in the activities of a terrorist group. Police said the purported plot reached to Iran, Afghanistan, Pakistan and Dubai.
Public Safety Minister Vic Toews said the arrests show that terrorism continues to be a real threat to Canada.
"The success of Operation Smooth is due to the fact that Canada works very closely with international partners to combat terrorism," he said in the House of Commons.
"Canada will not tolerate terrorist activity and we will not be used as a safe haven for terrorists or those who support terrorist activity."
U.S. Ambassador to Canada David Jacobson congratulated the RCMP on the arrests, saying they were the result of extensive cross-border co-operation.
"Dedicated professionals on both sides of the border brought these arrests to fruition, and I thank them for their service and hard work," Jacobson said in a statement.
"We all need to remain vigilant in confronting threats and keeping North America safe and secure."
The two suspects are expected to appear in court for a bail hearing Tuesday in Toronto.
— with files from Andy Blatchford and Hugo Prevost in Montreal, Paola Loriggio in Markham and Stephanie Levitz in Ottawa.Suggest a correction