Two Canadian men were found guilty Friday of terrorism-related charges stemming from a 2012 plot to derail a VIA passenger train in Toronto, the National Post reported. Chiheb Esseghaier, 31, and Raed Jaser, 37, were convicted following 10 days of jury deliberations.

Esseghaier, a Tunisian immigrant living in Montreal, was convicted of five charges, including three counts of participating in terrorism activities. Jaser, a man of Palestinian descent who was born in the United Arab Emirates and lives in Toronto, faces up to life in prison after being found guilty of planning to commit murder in association with or for the benefit of a terrorist group. Both men are Muslim. They were arrested in April 2013.

The jury wasn’t able to reach a verdict on a charge against Jaser of conspiring to damage transportation property with intent to endanger safety for the benefit of, at the direction of, or in association with a terrorist group.

Esseghaier was considered the mastermind of the plot, while prosecutors conceded that Jaser dropped out of the plans. Jaser’s attorneys tried to convince the jury that his client didn’t intend on carrying out the plan and that he just pretended to be interested in the plot so he could get money from Esseghaier and an undercover FBI agent who gained the trust of the two men, according to the CBC.

The FBI agent’s testimony may have been crucial to the convictions of Esseghaier and Jaser. Hours of secret recordings were played at the trial that included Jaser, Esseghaier and the undercover agent talking about making a hole in a railway bridge to cause the train derailment, the CBC reported. There was also video surveillance of the defendants looking at possible targets in southern Ontario, according to the National Post.     

Prosecutors contended that Esseghaier and Jaser were motivated by Islamic extremism and spent months devising the plot before their arrests two years ago, according to the Associated Press.

Esseghaier didn’t attempt to defend himself during the trial. Both men pleaded not guilty.