The Royal Canadian Mounted Police say 30-year-old Chiheb Esseghaier of Montreal and 35-year-old Raed Jaser of Toronto were conspiring to derail a passenger train, possibly targeting a bridge. Investigators believe the plan was sponsored by al Qaeda.
The plot did not get to the final stages of being operational and did not pose an imminent threat, officials said.
The suspects were arrested and charged with conspiring to carry out a terrorist attack. Police said the men are not Canadian citizens, but declined to say where they were from.
Canadian officials say the suspects were under surveillance since August and that there was no question they had help from outside Canada.
"The significance of this investigation was that it involved domestic attack planning being supported by al Qaeda," said Asst. Commissioner James Malizia of the Royal Canadian Mounted Police.
Officials with the Royal Canadian Mounted Police say their investigation took more than a year and had no connection to the Boston Marathon bombing. They also said the two men had ties to al Qaeda cells in Iran, possibly independent operators in the Persian Gulf region. But there is no evidence that the alleged plot had ties to the Iranian government.
The investigation was part of a cross-border operation involving Canadian law enforcement agencies, the FBI and the U.S. Department of Homeland Security.
Canada has had terror threats before. In 2006, 18 people were arrested for allegedly amassing tons of ammonium nitrate in an attempt to bomb a Canadian intelligence agency.
The operation is ongoing. Authorities say search warrants are still being executed, but it's unclear whether further arrests are expected. The suspects are set to make their first appearance in court on Tuesday for a bail hearing.
The Associated Press contributed to this report.