Image copyright Reuters Image caption Police say Aaron Driver had planned to carry out a major attack

A man killed by police in Canada was preparing an immediate attack with a homemade bomb, police said.

He had already detonated one device inside a taxi during rush hour, injuring the driver, and was carrying a second.

Aaron Driver, 24, was known to the authorities for supporting the so-called Islamic State (IS) group.

A senior officer at the Royal Canadian Mounted Police (RCMP) said it was "a race against time".

Driver's father said he knew his son was "lost" but did not know "how far he had gone".

It is unclear where Driver was travelling and whether it was to his intended target, police said. They added that there was no reason to believe he had any accomplices.

Mike Cabana, RCMP deputy commissioner, said the FBI alerted Canadian authorities early on Wednesday about an "unknown individual that was clearly in the final stages of planning an attack using a homemade explosive device" in Canada.

"Obviously it was a race against time," Mr Cabana said. "How quickly this was all established is actually a testament to the level of collaboration that exists between law enforcement agencies."

Can Canada preserve its openness?

Viewpoint: Canada's growing extremism

Image copyright AP Image caption Aaron Driver had been arrested before

The tip included a "martyrdom" video purporting to show a masked suspect, later identified as Driver, saying he planned to detonate an explosive device in an urban centre during morning or afternoon rush hour.

Mr Cabana said it was still too early to say how the FBI obtained the video of Driver.

Police played the video at a news conference, showing a masked man denouncing Western "enemies of Islam," making reference to the attacks in Paris and Brussels and pledging his support to IS.

"You will pay for everything you brought against us," the suspect in the video said.

On Thursday, a news agency associated with IS called Driver a "soldier of the Islamic State".

The Canadian Security Intelligence Service (CSIS) first learned of Driver when he tweeted his support for IS under the alias Harun Abdurahman in October 2014.

Mr Cabana added that Driver had been in contact with a 15-year-old British boy who plotted to behead police officers at an Anzac Day parade in Australia.

'We never gave up hope'

Driver's father, Wayne Driver, told the Canadian Broadcasting Corporation (CBC): "I knew he was lost but I didn't know how far gone he was.

"I didn't realise he was so radicalised. I didn't know he could speak Arabic so well.

"I knew he was mad at the world because of his mother dying but I didn't realise he was turning his hatred outward to the world.

"We never gave up hope - we kept constantly trying and reaching out. But now that's all gone."

Restricted movement

Driver, who was arrested in Winnipeg last June for supporting IS on social media, was under a peace bond, or a court order restricting his movements.

Conditions of his peace bond included restricting access to a computer, cell phone, mobile device, social media and prohibiting him from having any contact with IS or other terrorist groups.

He was ordered to wear a GPS tracking device, but it was removed earlier this year.

Though his movements were restricted, RCMP officials said that he was not under constant surveillance.

Image copyright Royal Canadian Mounted Police Image caption Police say they shot Driver before he detonated a second device

Toronto's transit agencies had been notified of an unspecified security threat before the police confrontation, according to Brad Ross, a spokesman for the Toronto Transit Commission.

Leonard Tailleur, Driver's former lawyer, described his former a client to the BBC as a "very passive person," "respectful" and one of the best clients he has ever had.

Mr Tailleur, who represented Driver in 2015 but had not seen him since February, said his client had never indicated he would engage in terrorist activities.

The national terrorism threat level for Canada remains at a "medium," which it has been at since 2014.

How do countries handle terrorism suspects?