The suspect accused of stabbing a police officer before crashing a speeding U-Haul van into a crowd of people in Edmonton, Canada, had come to the country from Somalia trying to claim refugee status, police revealed.

Officers took the 30-year-old suspect into custody and he apparently acted alone, Edmonton Police Chief Rod Knecht said. Officers said pending charges included terrorism and five counts of attempted murder, but they did not reveal his name.

An Islamic State flag was found in the car that hit the officer, according to Knecht.

The suspect was known to both Edmonton police and the Royal Canadian Mounted Police. Marlin Degrand, assistant commissioner of the Royal Canadian Mounted Police, said the man was flagged in 2015 for extremist ideologies and police interviewed him at the time, but he said charges were not warranted after an "exhaustive investigation." It was not clear when he first traveled to Canada.

"We condemn the cowardly terror attacks on a police officer and pedestrians that occurred late last night in Edmonton, Canada. Law enforcement authorities from the United States are in touch with their Canadian counterparts to offer assistance with the ongoing investigation. Our thoughts and prayers are with the victims, as we hope for their speedy and complete recovery," White House Press Secretary Sarah Sanders told reporters.

The chaos began outside Commonwealth Stadium, where a Canadian Football League game was being played.

In video released by police, a white Chevrolet Malibu slammed into a police officer in front of his cruiser. The officer was sent flying after the Malibu struck the police car. The driver then got out and appeared to stab the officer.

The officer was stabbed multiple times before the suspect ran off, the Edmonton Journal reported.

The officer was not critically wounded, the Globe and Mail reported.

A few hours later, the U-Haul van was stopped at an impaired driving checkpoint. Knecht said the driver's name was similar to the name of the registered owner of the car that hit the officer. He said the van then sped off toward downtown with police in pursuit.

Police say the U-Haul hit and injured four pedestrians before it rolled and the suspect was arrested.

“There were people flying and everything,” witness Kim Anderson told the Edmonton Journal. “I’m shocked — I just see people flying.”

“The Government of Canada and Canadians stand with the people of Edmonton after the terrorist attack on Saturday that sent an Edmonton Police Service officer to hospital and injured a number of innocent people who were out to cheer on their football team and to enjoy an evening in their city," Canadian Prime Minister Justin Trudeau said in a statement, adding that he felt "deeply concerned and outraged by this tragedy."

Fox News' Wes Barrett and The Associated Press contributed to this report.