A prosecutor says two men charged with plotting to attack a passenger train travelling between Canada and the U.S. were motivated by Islamic extremism and spent months plotting to kill as many people as they could.

Raed Jaser and Chiheb Esseghaier face multiple charges in the alleged plot to derail a Via passenger train running between Toronto and New York City. They have pleaded not guilty.

Prosecutor Croft Michaelson said at the start of the trial Monday that Tunisian national Esseghaier told an undercover FBI officer that he wanted cause a 6-meter (20-foot) hole in a railway bridge.

Michaelson says Jaser and Esseghaier took trips to at least two railway bridges in Canada as they plotted the attack. Jaser is a permanent Canadian resident of Palestinian descent.