Ontario’s top court has upheld a decision allowing a man found not criminally responsible in a knife attack at a Toronto military recruitment centre to eventually take college classes on his own.

The appeal court says the Ontario Review Board considered all the required factors last year in granting Ayanle Hassan Ali permission to attend Mohawk College unaccompanied when staff at the secure Hamilton hospital where he’s detained deem he is ready.

The three-judge appeal panel further says it was “not unreasonable” for the board to ban Ali from known military facilities or centres rather than the more restrictive measure sought by the Crown – a prohibition from contacting any military personnel.

READ MORE: Crown argues man who attacked military personnel in Toronto should be deemed terrorist

Prosecutors had challenged the board’s ruling, saying too much consideration had been given to Ali’s needs and too little to public safety.

Story continues below advertisement

They argued awarding such privileges was unreasonable given that it was Ali’s first review and he had no track record to rely on.

The Crown said Ali’s compliance with the rules on his highly restricted hospital ward is not the same as having “unsupervised access” to the college.

The review board – which annually evaluates the status of anyone found not criminally responsible or unfit to stand trial for criminal offences due to mental illness – found Ali continues to pose a significant threat to the public and should remain at the hospital.

But it also granted him gradually increasing privileges that began with permission to travel through the hospital and grounds with staff, then with an approved companion, and eventually under “indirect supervision,” which means being unaccompanied.

If that went well, Ali could then follow similar steps into the community for education purposes, specifically to go to Mohawk College, which is across the street from the hospital, the board said.

In a decision released Monday, the Appeal Court said arguments related to public safety were made at the hearing and, as such, were weighed by the board.

“It is clear from the reasons of the board and the conduct of the hearing that the board carefully considered all of the required factors in making its disposition regarding the limited indirect supervision privilege and made no error of law. Its decision was not unreasonable,” the appeal court said.

Story continues below advertisement

READ MORE: Trial for man accused of terror attack on Toronto military recruitment centre begins

“The limited extension of indirectly supervised access only to the local college shows that the board was extending only a very limited privilege, both geographically and in terms of time away, that reflected its concern for public safety but balanced with the need to facilitate Mr. Ali’s reintegration into society.”

At the initial hearing, the Crown had sought an order barring Ali from contacting any military personnel, but his lawyers argued Ali would not know if someone in plain clothes might be in the military. At the appeal, prosecutors said the condition could have been modified to avoid such concerns by prohibiting contact with uniformed personnel.

The Appeal Court noted Ali is scheduled to appear before the board on Wednesday and such a condition may be discussed at that time.

Ali attacked several uniformed military personnel with a large knife in March 2016 and wounded at least two people before he was overpowered and subdued.

READ MORE: Stabbing suspect once had restricted airport security clearance

He was charged with attempted murder, assault causing bodily harm and assault with a weapon, as well as carrying a weapon, all for the benefit of a terrorist group.

Story continues below advertisement

Last year, an Ontario judge found that while Ali carried out the attack based on his extremist beliefs, the formation of those beliefs was precipitated by mental illness. The judge also found Ali was not acting on behalf of or for the benefit of a terrorist group.

As a result, Ali was cleared on the terror element of the charges and found not criminally responsible on the lesser included offences.

Prosecutors are also appealing that finding, arguing Ali should be considered a terrorist even though he acted alone. They say Ali should still be considered not criminally responsible, but on the terror charges rather than the lesser ones, and are seeking a new trial on that issue.