Image caption Chiheb Esseghaier was tracked by Canadian and US officials for at least a year

One of the men accused of plotting to derail a Canadian passenger train has challenged the Canadian legal system's authority over him.

Chiheb Esseghaier, 30, told a Toronto judge that "all of these conclusions" were based on the country's criminal code, which was "not a holy book".

He and co-defendant Raed Jaser, 35, are charged with conspiracy to carry out an attack and kill people.

They are accused of plotting to bomb a train between New York and Montreal.

'Save it'

Analysis Some Canadian Muslim leaders say they fear the impact of a story like this on the public perception of their community. But there is a close working relationship between community leaders and the police. It was Raed Jaser's father who first expressed concerns about his son's religious views several years ago. Mohammed Robert Heft, a convert who has worked closely with the authorities in recent years, called the relationship between community leaders and the police "a model for the international community". He says leaders call the police if they have concerns about what they're seeing and hearing. But the signs are not always easy to spot. Mr Esseghaier and Mr Jaser both seem to have behaved in ways that rang alarm bells with family members and co-workers, but Mr Heft says extreme radicalisation tends to be a private thing. Canada's Muslims reflect after arrests

Both have said they will challenge the case against them.

Officials have said the alleged plot had support from al-Qaeda in Iran, although they say they have no evidence of state sponsorship.

The two men's arrest comes amid debate and an expected vote on Wednesday on changes to Canada's Anti-Terrorism Act.

Mr Esseghaier told a Toronto court on Wednesday "we know that this criminal code is not a holy book. It's just written by a set of creations and the creations... are not perfect because only the creator is perfect."

The judge told him to "save that for another court", and to take his lawyers' advice.

He has declined to be represented by a court-appointed lawyer.

Mr Esseghaier, a Tunisian national, was studying for a doctorate at the National Institute for Scientific Research near Montreal, while Mr Jaser reportedly worked as a customer service agent at a removal firm.

Mr Jaser was born in the United Arab Emirates to Palestinian-origin parents. He and his parents came to Canada 20 years ago as refugees, although he only recently obtained permanent Canadian residence.

Canadian media have reported the investigation was launched after a tip-off by a concerned imam in the Toronto Muslim community. Authorities had been tracking Mr Esseghaier for two years before beginning to investigate the alleged plot in August 2012, CTV reported.

'Notable' timing

Mr Jaser's lawyer John Norris has questioned the timing of the arrests, which came as the Canadian parliament debated an anti-terrorism bill that would reintroduce "preventative detention" and investigative hearings.

"I don't know what their purposes were but their timing was notable to say the least," Mr Norris was quoted by the Globe and Mail newspaper as saying.

Some analysts have said the arrests came because Canadian authorities felt a sense of urgency after the Boston Marathon bombings and others reported police decided to act after their investigation indicated the alleged plot was coming close to fruition.

Canadian Public Safety Minister Vic Toews declined to comment on the timing of the arrests.

Via Rail, which operates passenger rail services across Canada and carries nearly four million passengers annually, said the public was never in danger.

Mr Esseghaier and Mr Jaser are expected to return to court on 23 May.