TORONTO — A legal battle over the sanity of convicted terrorist Chiheb Esseghaier is set to stretch into the appeal phase after an Ontario judge appointed two lawyers to act in his case Wednesday.

Esseghaier was convicted last spring, along with an accomplice, of conspiring to kill Canadians in a terrorist act. An undercover FBI agent recorded Esseghaier and Raed Jaser discussing plans to blow a hole in a railway bridge, poison the food on a military base or shoot prominent citizens with a sniper rifle.

Both men were sentenced to life in prison without the possibility of parole until 2023 at the earliest. But during the sentencing phase of their trial, concerns over Esseghaier’s mental health emerged.

Two different psychiatrists diagnosed Esseghaier during his sentencing as mentally ill and likely schizophrenic. The former PhD student from Tunisia acted erratically in court, spitting repeatedly at a witness and throwing water at a lawyer.

But Superior Court Justice Michael Code refused to order a formal hearing into Esseghaier’s fitness to stand trial. He also dismissed the idea that Esseghaier might not have been criminally responsible for his actions due to mental illness.

On Wednesday, Esseghaier appeared at an Ontario Court of Appeal hearing via video link. He’s currently being held in a prison in Quebec and has filed notice that he plans to appeal his conviction on the narrow grounds that he was denied the right to be tried under Qur’anic law.

It now appears likely, however, that other grounds of appeal will be raised on Esseghaier’s behalf. Over the opposition of the Crown, Appeal Court Justice Kathryn Feldman appointed two Toronto lawyers, Joseph Di Luca and Erin Dann, to act as amicus curiae, or friends of the court, during the appeal.

Feldman did so after another lawyer submitted an affidavit signed by Russell Silverstein, a lawyer who served as amicus during Esseghaier’s trial, in which Silverstein accused Code of failing “in his duty to safeguard the interests of a self-represented accused” and of causing “a miscarriage of justice” by refusing to order an assessment of Esseghaier’s fitness.

The two amicus lawyers will be free to raise whatever legal issues they see as relevant, regardless of Esseghaier’s views, according to Di Luca. “The court has an interest in making sure that justice is done fairly,” he said, “and our goal is to assist the court in that challenge.”

Esseghaier appeared relaxed during the hearing Wednesday. He told the court he has no plans to appeal his sentence, because he does not believe he will live to see it carried out. “The life sentence will not happen,” he said. Instead, he expects to be taken into heaven by God on Dec. 25, 2014, while on a plane to Tunisia.

(Esseghaier believes it is still 2014 and that guards and court officials have tried to trick him into believing otherwise.)

Jaser, Esseghaier’s co-accused, has also filed notice that he plans to appeal his conviction.