TORONTO - A 27-year-old Canadian man said, "Allah told me to come here and kill people" at a double stabbing at a military recruitment center in Toronto, police said Tuesday.

Toronto Police Chief Mark Saunders said Ayanie Hassan Ali had been charged with one count of attempted murder, two counts of assault with a weapon, two weapons charges and one assault charge.

Saunders said the suspect walked into the center on Monday and began striking a uniformed Canadian Forces member at the front desk before slashing him on the right upper arm. He said the suspect then attempted to slash a female member of the Forces before he was subdued.

Get Breaking News Delivered to Your Inbox

"While at the scene, the accused stated that 'Allah told me to do this, Allah told me to come here and kill people,'" Saunders said.

He said police were investigating whether the attack was terrorism and that there was nothing to indicate the Montreal-born man was working with anyone or any organization. He said Ali had no previous criminal record and was unresponsive to questions at the scene.

The police chief urged the public against any anti-Islam sentiment in the wake of the attack.

Ali will appear in court later Tuesday.

Canadian Prime Minister Justin Trudeau tweeted that Canadians and the Canadian Forces "will not be intimated by terror & hate" and wished those injured a full recovery.

The Royal Canadian Mounted Police and Canada's intelligence service were involved in the investigation of the attack.

"Obviously it's not something we see on a daily basis; however, we are professionals and we always have to take care of our own people," said Major Richard Silva, a spokesman for the recruitment center.

In 2014, a man authorities described as an "ISIL-inspired terrorist" ran over two soldiers in a parking lot in Quebec, killing one and injuring the other before being shot to death by police. The man had been under surveillance by Canadian authorities, who feared he had jihadist ambitions and seized his passport when he tried to travel to Turkey.

Two days later, a gunman killed a Canadian soldier at the war memorial in Ottawa and then stormed Parliament before being shot dead. The man had taken issue with Canada's involvement in the war in Afghanistan and the fight against the Islamic State group.

Canada's new Liberal government has ended airstrikes against the Islamic State but has tripled the number of soldiers that train Kurdish soldiers in Northern Iraq.