Two men charged with an alleged Al Qaeda-backed plot to derail a Canadian passenger train have made their first court appearances.

Raed Jaser of Toronto, 35, and Chiheb Esseghaier, 30, face charges that include conspiring "with each other to murder unknown persons for the benefit of, at the direction of, or in association with a terrorist group".

They were arrested on Tuesday in separate raids after what police said was an investigation that started in the middle of last year after a tip from a member of the Muslim community.

Officers detained Jaser at his home, a brick semi-detached house in a north Toronto neighbourhood, and arrested Esseghaier at a McDonald's restaurant in Montreal's main train station.

US officials said the suspects were believed to have worked on a plan involving blowing up a trestle on the Canadian side of the border as the Maple Leaf, Amtrak's daily connection between Toronto and New York, passed over it.

Canadian police said only that the plot involved a passenger train route in the Toronto area.

They said there had been no immediate threat to rail passengers or to the public.

Jaser, dark and heavily bearded and wearing a black cap, arrived by police car at Toronto's Old City Hall courthouse.

'Shock and disbelief'

He was kept in custody after a brief hearing which media were banned from reporting details under an order requested by his lawyer.

"He denies the allegations and he will vigorously defend them," lawyer John Norris said outside the court, describing Jaser as being in a state of "shock and disbelief."

Outside the courtroom, a middle-aged man and a woman in a cream-colored hijab identified themselves as members of Jaser's family, but would not answer questions.

With them were two younger men and two women in full black niqab face veils, who fled when confronted with a throng of reporters, photographers and television crews.

Esseghaier, a Tunisian-born doctoral student at a Montreal-area university, was flown to Toronto on Monday (local time), but was quickly returned to Montreal to meet a legal requirement that he appear in a Quebec court within 24 hours of his arrest.

Bearded and bespectacled and wearing a shabby blue-and-black winter jacket, handcuffs and leg shackles, he told the judge there that conclusions had been drawn from facts and words "that are only appearances."

He was remanded in custody and federal prosecutor Richard Roy said he expected Esseghaier to be flown back to Toronto later on Tuesday (local time) for a court appearance there.

Esseghaier represented himself at the hearing, which was not covered by a publication ban.

Canadian authorities have linked the two to Al Qaeda factions in Iran but say there is no indication the attack plans were state-sponsored.

"Had this plot been carried out, it would have resulted in innocent people being killed or seriously injured," Royal Canadian Mounted Police official James Malizia said earlier.

Police said they had been investigating the two since last fall after a tip from the Muslim community in Toronto.

Iran has reacted angrily to being tied to the arrests. Canada last year severed diplomatic ties over what it said was Iran's support for terrorist groups, as well as its nuclear program and its hostility towards Israel.