Prime Minister Justin Trudeau says the government is reviewing its handling of refugee claims following revelations that a Somali man accused in attacks in Edmonton had been ordered deported from the United States.

Trudeau says the government is trying to find out what happened with the case of Abdulahi Hasan Sharif.

The Canadian government has said that Sharif presented himself at a regular port of entry in 2012 and was cleared as a refugee in Canada.

U.S. Immigration and Customs Enforcement says that Sharif was transferred into its custody at a detention center in San Diego in July 2011 and was ordered removed to Somalia that September.

About two months later, he was released on an order of supervision in San Diego but failed to report on his scheduled date in January 2012.

Trudeau says Canada is looking into what happened and whether things need to be done differently than they were in 2012.

"It's certain that we have asylum processes that need to be followed rule by rule when someone presents themselves at our border. We have rules to follow and we make sure those rules are followed," he said in Ottawa on Wednesday.

"The priority is always making sure we're defending the values and rights of Canadians while keeping our communities safe."

Sharif is accused of attacking a police officer and running down four pedestrians in Edmonton.

He made his first court appearance Tuesday on 11 charges, including five of attempted murder, that were laid after a driver hit an Edmonton police officer with a speeding car, stabbed him and then mowed down pedestrians with a cube van during a downtown police chase.

Tactical officers forced the van on its side and arrested a suspect after using a stun grenade and a Taser.

His case was put over until Nov. 14 to give him time to find a lawyer, but it could be called back sooner if Sharif can hire legal counsel before then.

Meanwhile, U.S. Immigration and Customs Enforcement said Tuesday that Sharif was transferred into its custody at the Otay Mesa Detention Center in San Diego on July 15, 2011, by U.S. Customs and Border Protection.

It says Sharif was ordered removed to Somalia on Sept. 22, 2011, and he waived his right to appeal the decision.

About two months later, he was released on an order of supervision by the department in San Diego "due to a lack of likelihood of his removal in the reasonably foreseeable future."

He failed to report on his scheduled date of Jan. 24, 2012, and efforts to find him were not successful, the department said in a statement.

Sharif's name is spelled Abdullahi Hassan Sharif in the United States.

An official with Immigration and Customs Enforcement who spoke on the condition of anonymity told The Canadian Press they have no reason to believe it is not the same man.

Both a U.S. and Canadian government official told The Associated Press it is the same man.

The U.S. official said slightly different spellings are not uncommon. She also agreed to discuss the matter only if not quoted by name, because she was not authorized to discuss certain details of the case.

A spokesman for Public Safety Minister Ralph Goodale said Sharif entered Canada from the United States through a regular port of entry in 2012 and was granted refugee status later that year.

"As minister Goodale has stated, there was no information that would have raised any red flags when he entered Canada. Due to privacy laws we cannot disclose further details of this case," Scott Bardsley said in an emailed statement.

"According to U.S. authorities, he was not detained for criminal activity."

Bardsley said generally, individuals who are inadmissible, including for serious crimes, would be ineligible to make an asylum claim in Canada.

"Being detained for immigration purposes in another country would not prevent someone from being able to make an asylum claim in Canada," he said.

Sharif, 30, appeared on closed-circuit TV in a courtroom in Edmonton and followed the proceedings with the help of an interpreter. The accused spoke briefly with a lawyer who stepped forward to help.

Edmonton police have raised the possibility of terrorism charges against Sharif because there was an Islamic State flag in his car and he was investigated two years ago for espousing extremist views.

The RCMP has said the investigation is complex and no terrorism charges have been laid.

Mahamad Accord, a member of Edmonton's Somali community, said he will do what he can to help Sharif apply for legal aid if he can't afford to hire his own lawyer.

"As you know Canadians — everyone has the right to a fair trial," Accord said outside court.

He said there has been lots of hearsay about Sharif, but no first-hand information.

Ahmed Ali, a man who described himself as a spokesman for the city's Somali community, said Sharif will get help with an interpreter, but wouldn't comment about helping him get a lawyer.

Ali also declined to answer questions about Sharif's background or whether Somalis are facing any backlash over the attacks.

"I would be lying if I told you that members of our community are feeling threatened, scared or concerned, because the EPS (Edmonton Police Service) has been doing a fantastic job, and so have the RCMP," he said outside court.

Sharif also faces charges of dangerous driving, criminal flight causing bodily harm and possession of a weapon for a dangerous purpose.

Police have said they believe the suspect acted alone and without conspirators.

Const. Mike Chernyk was handling crowd control at a Canadian Football League game Saturday night when he was hit by a car that rammed through a barrier and sent him flying. The driver got out, pulled out a large knife and began stabbing Chernyk.

The constable was treated in hospital and released.

As of Monday, two of the pedestrians remained in hospital, one with a fractured skull.

RCMP have said Sharif was checked thoroughly in 2015 after police received a report that he may have been radicalized, but investigators determined that he did not pose a threat.

Editor's note: This story was updated with comments from the prime minister at 1:21 p.m. EST on Wednesday Oct. 4, 2017.

Keep reading