A judge ruled Tuesday that a man accused of stabbing soldiers at a Toronto military recruitment centre is unfit to stand trial — just hours after the RCMP laid terrorism charges in the case.

Ayanle Hassan Ali, a 27-year-old born in Montreal, allegedly stabbed several soldiers inside the recruitment centre, sending two to hospital. Nobody was killed in the attack.

The lawyer representing Ali sent a statement to The Canadian Press saying the ruling was handed down following a two-month psychiatric evaluation.

Maureen Addie said her client was found to be "unfit to stand trial due to the ongoing psychotic symptoms of a major mental illness."

Judge Riun Shandler of the Ontario Court of Justice has ordered Ali to undergo 60 days of treatment in a bid to improve his condition and leave him able to stand trial.

If so, Ali faces a raft of charges, including the terrorism counts laid against him on Tuesday. Ali also faces nine criminal charges in connection with the March stabbing.

According to Toronto police Chief Mark Saunders, a man walked past a master corporal stationed at the door of the Joseph Shepard Building at 4900 Yonge St., just north of Sheppard Avenue, on the afternoon of March 14. The man then stabbed the master corporal when he tried to stop him.

Authorities said the attacker then stabbed a second military member who tried to apprehend him.

Attempts to slash a uniformed female Canadian Forces member were unsuccessful, Saunders said a day after the attack.

The two who were stabbed were treated in hospital and released. Their injuries weren't life threatening.

RCMP charges come months after attack

On Tuesday, RCMP said they have charged Ali with three counts of attempted murder, two counts of committing assault causing bodily harm, three counts of committing assault using a weapon, and one count of carrying a weapon dangerous to the public, for the benefit of a terrorist group.

RCMP Const. Annie Delisle confirmed that the Mounties have laid nine separate charges against Ali.

Delisle said the charges are in addition to the ones laid on March 15 by Toronto police:

Three counts of attempted murder.

Two counts of aggravated assault.

Three counts of assault with a weapon.

One count of carrying a weapon dangerous to the public.

"Terrorism-related charges require a significant investigation, which can be time consuming," assistant commissioner Jennifer Strachan, commanding officer of RCMP "O" Division, said in the release. "I would like to highlight the efforts of our INSET here in Ontario which worked diligently to obtain the evidence required for these charges."

INSET teams are made up of representatives from multiple law-enforcement agencies that investigate national security threats.