A top Ontario court upheld its decision to allow Ayanle Hassan Ali–who attacked several soldiers with a large knife in 2016–to attend Mohawk College in Hamilton, Ontario.

Ali was not held criminal responsible for the attack, which saw three uniformed personnel wounded, as he was deemed not to be in a fit state of mind, when he explained that Allah told him to carry out the attack.

Ali was originally charged with attempted murder, assault causing bodily harm and assault with a weapon, as well as carrying a weapon, for the benefit of a terrorist organization.

In reaching the decision, the National Post reports:

…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.

Arguments presented to the Appeal Court concerning public safety were considered.

“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.

“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.”

Initially, Ali was barred from contacting any military personnel, but his lawyer argued that he may not be able to differentiate a member of the armed forces from a civilian when wearing regular clothing.

However, according to the Toronto Sun, the board found that Ali, who suffers from schizophrenia, “still poses a significant threat to the safety of the public” and “holds some of the same delusions, that he experienced at the time of the (attack).”

For the first year of classes, Ali will attend Mohawk under supervision.

With approval from St. Joseph’s Hospital, Ali may begin to take classes unsupervised, in a year’s time, depending on the severity of his condition.