Canada was already on edge after a radical Muslim convert killed a soldier and injured a second on Tuesday in a deliberate hit-and-run car attack in Quebec before being shot dead by police.
The similarity in the reported backgrounds of the two killers has raised fears "lone-wolf" extremists - possibly a cell of radical converts in Quebec - are targeting Canadian military personnel in retaliation for the Government's support of United States-led air strikes in Iraq and Syria.
Zehaf-Bibeau's victim was identified as Corporal Nathan Cirillo, 24, a reserve infantryman and young father who was part of a two-man honour guard carrying an unloaded rifle at the war memorial.
In a chilling detail, a witness described how the gunman raised his arms in a display of triumph, a rifle in the air, after shooting Cirillo at point blank range in front of the cenotaph. The location for the start of his rampage appeared horrifically symbolic as it honours the country's war dead.
Canada had just the day before raised its domestic terror threat level from low to medium because of "an increase in general chatter from radical Islamist organisations", officials said. Ottawa also this week sent six fighter jets to the Middle East to join US-led strikes against the Islamic State (Isis) after a parliamentary vote.
During his rampage, Zehaf-Bibeau came alarmingly close to Prime Minister Stephen Harper, who was meeting MPs as the gunman burst into the Parliament with his gun blazing.
Harper was rushed from the building while other politicians dived for cover under tables.
Ottawa Hospital said it received three victims of the shooting, including Cirillo who was pronounced dead despite frantic attempts by passers-by to save his life. The other patients, one of whom was a parliamentary aide, were discharged by the evening.
Sergeant at arms Kevin Vickers was praised by MPs for saving further lives after he shot the gunman outside rooms packed with politicians gathered for weekly caucus meetings.
"MPs and staff owe their safety, even lives, to Kevin Vickers, who shot the attacker just outside the MPs' caucus rooms," said Craig Scott, a New Democrat MP.
But with the centre of a Western capital under lockdown, troubling questions were raised about security arrangements at the Parliament after a gunman was able to dash through the seat of government.
It emerged that the Auditor-General called two years ago for a unified security force to protect the complex, but his recommendations were not implemented. Michael Ferguson identified potential flaws in the current shared system under which the area is protected by four different federal and city forces.
The mayhem erupted at 9.50am local time when a car reportedly drew up at the war memorial and a gunman stepped out. As tourists watched in horror, he shot a ceremonial guard with what witnesses described as a high-powered rifle.
"I looked out the window and saw a shooter, a man dressed all in black with a kerchief over his nose and mouth and something over his head as well, holding a rifle and shooting an honour guard in front of the cenotaph point-blank," said Tony Zobl, 35, who saw the shooting from a window overlooking the memorial.
"The honour guard dropped to the ground, and the shooter kind of raised his arms in triumph holding the rifle."
Peter Henderson, a journalist, was just locking up his bike near the war memorial when he heard gunshots.
"I heard four shots from that direction and I turned around and ran. I saw one of the soldiers laying on the ground," he told CNN. "There's a ceremonial uniform they wear and it struck me as I ran, I just saw the white gloves and I knew who he was. It sounded like [the shots] came from a very high-powered rifle."
The attacker then headed the short distance to the Parliament building, which was full of MPs and senators.
Gunfire broke out shortly before 10am. Politicians and aides barricaded doors with chairs.
The gunman fought a running battle in the Gothic hallways with armed police and security before he was felled in a hail of bullets. There were unconfirmed reports of at least one more gunman running through the building or on the roof.
Tony Clement, a Cabinet minister, described the scene inside Parliament on Twitter. "Shots fired during caucus meeting," he said. "At least 30 shots. MPs piled out. I'm safe with 2 colleagues but we're still at risk."
Conservative MP Kyle Seeback also conveyed the mood. "Horrific day on Parliament hill," he said. "Shots fired inside centre block during our caucus meeting. I'm safe locked in an office awaiting security."
The Parliament, nearby embassies, offices and schools remained in security lockdown and police told people to stay off streets and away from windows amid reports that at least one other suspect was loose.
Zehaf-Bibeau had apparently had several run-ins in the past with Canadian police in the French-speaking province of Quebec.
Quebec court records showed three 2004 cases involving a Michael Zehaf-Bibeau, born in 1982, Reuters reported. That year he pleaded guilty to two drug-related offences and one charge of failing to comply with a judge's order.
His mother, Susan, is the deputy chairwoman of the Immigration and Refugee Board of Canada, according to Radio Canada.
The Globe and Mail newspaper, citing government sources, said he was recently designated a "high-risk traveller" by the Canadian Government - meaning it was feared he would travel abroad to commit crimes - and that his passport had been seized.
Those were similar circumstances to Martin Couture-Rouleau, another recent convert from Quebec who ran down and killed a soldier on Tuesday.
Couture-Rouleau was arrested at the airport in July on his way to Turkey and also had his passport confiscated. He was among 90 people being tracked by the Royal Canadian Mounted Police on suspicion of taking part in militant activities abroad or planning to do so.
Canada recently estimated that at least 30 of its citizens were fighting with Islamic extremist groups in Syria amid concerns about home-grown terrorist attacks.
United States President Barack Obama was briefed on the attack by White House national security officials and he later spoke to Harper by telephone.
Washington ordered tightened security at the tomb of the unknown soldier at Arlington national cemetery amid concerns that American military personnel could also be targeted.