Michael Zehaf-Bibeau
The gunman recorded the chilling video in his car before attacking the parliament.

A video recorded by a gunman just minutes before he stormed Canada's parliament building has been released by police.

Michael Zehaf-Bibeau was killed in a stand-off as he attempted to storm the parliament in the Canadian capital on 22 October. He was shot dead by the Sergeant-at-Arms after entering the building.

In the newly-released footage filmed on his mobile phone as he sat in his car, Zehaf-Bibeau explains his motive for the attack.

"To those who are involved and listen to this movie, this is in retaliation for Afghanistan and because (Canadian Prime Minister Stephen) Harper wants to send his troops to Iraq," he says.

"So we are retaliating, the Mujahedin of this world ... just aiming to hit some soldiers just to show that you're not even safe in your own land, and you gotta be careful."

"We'll not cease until you guys decide to be a peaceful country ... and stop going to other countries and stop occupying and killing the righteous of us who are trying to bring back religious law in our countries," says the 32-year-old.

Royal Canadian Mounted Police Commissioner Bob Paulson said 13 seconds had been cut from the start of the video and five seconds from the end for operational reasons.

He added that investigators believed that Zehaf-Bibeau was not part of an organised network of terrorists and was operating as a lone wolf. However, evidence suggests he had been influenced by other militants. Two days earlier, another convert to Islam ran over two soldiers in Quebec, killing one of them.

"I wouldn't characterise it as network as it is commonly understood but I am persuaded that he was influenced by other individuals toward these crimes so in that sense I am of the view that others were involved," said Paulson.

Ottawa Shooting: Shocking First Video of Gunman Inside Parliament
A still from a video taken inside the Parliament building during the shootingThe Globe and Mail

The Canadian national, who was a Muslim convert, launched the attack three weeks after Canada decided to deploy troops to Iraq to fight Islamic State terror.

24-year-old Corporal Nathan Cirillo was killed in the attack as he stood guard at a War Memorial.

Zehaf-Bibeau had previously struggled with drug addiction, however an autopsy revealed he was not under the influence of alcohol or drugs at the time of the attack.

Police also said there was no evidence he suffered mental health issues.