EDMONTON, Alberta (Reuters) - The Somali immigrant charged with attempted murder in connection with a weekend vehicle and knife attack in Edmonton, Alberta, was detained in the United States pending deportation before claiming refugee status in Canada, U.S. officials said on Tuesday.

FILE PHOTO - Abdulahi Hasan Sharif, 30, a Somali immigrant, is shown in this police booking photo provided in Edmonton, Alberta, Canada, October 2, 2017. Edmonton Police Department/Handout via REUTERS

Abdulahi Hasan Sharif, 30, is accused of running down a police officer with his car on Saturday night and then stabbing him repeatedly. Police said he fled before driving a U-Haul truck into four pedestrians during an attempt to evade capture.

Sharif was in custody in the United States for about four months in the summer and autumn of 2011, U.S. Immigration and Customs Enforcement (ICE) spokeswoman Lauren Mack said in a statement.

He was ordered deported to Somalia but released on an “order of supervision” on Nov. 23, 2011. Sharif did not appear for a scheduled meeting in January 2012, and efforts to locate him “were not successful,” the statement said.

Sharif “had no known criminal history at the time of his encounters with ICE,” the ICE statement added.

Canadian Public Safety Minister Ralph Goodale said Sharif made a refugee claim at a Canadian border crossing in 2012 and obtained refugee status later that year.

In 2015, a complaint led police to probe Sharif’s alleged extremist ideology, but officers found no grounds for criminal charges after what the Royal Canadian Mounted Police described as an “exhaustive investigation.”

Goodale said on Monday it would be wrong to blame the attack on any shortcomings in Canada’s immigration and refugee vetting system.

Sharif, who faces 11 charges including five counts of attempted murder, appeared via video in an Edmonton court on Tuesday wearing an orange jail uniform. He had a Somali interpreter, although he did not speak.

He occasionally looked down or clasped his hands in front of him and still bore facial bruises that police say he sustained while evading capture.

A community leader, Mahamad Accord, who did not speak to Sharif but learned about him from the local Somali community, said Sharif was from a Somali ethnic minority and little known in the community.

Edmonton police did not immediately respond to a request for comment.

Sharif’s lawyer, Chady Moustarah, said he had stepped in on short notice to help someone without representation but that the accused would have to find another lawyer going forward. Sharif remains in custody until his next court appearance, scheduled for Nov. 14.