A CANADIAN soldier standing guard at a war memorial was shot dead before a gunman entered the parliament buildings and opened fire outside a room where Prime Minister Stephen Harper was hosting a meeting.

One gunman was killed, but police said they were hunting for as many as two others.

The bloodshed raised fears of a co-ordinated terrorist attack, with Canada on alert because of a fatal hit-and-run this week against two soldiers by a Muslim convert. He was shot dead by police.

Witnesses to yesterday's incident said the soldier was gunned down at point-blank range by a man carrying a rifle and dressed all in black with a scarf over his face. They said the gunman then ran off and entered Parliament, a few hundred yards away, where dozens of shots soon rang out. Last night the possible suspect was named as Michael Zehaf-Bibeau.

People fled the complex or took cover inside as police armed with rifles and body armour took up positions outside and cordoned off the normally bustling streets around parliament.

Police gave no details on how the gunman died. But on Twitter, MP Craig Scott credited parliament's sergeant-at-arms Kevin Vickers with shooting the attacker just outside the MPs' caucus rooms.

An Ottawa police spokesman said two or three gunmen were believed to be involved in the attacks. Gilles Michaud, assistant commissioner of the Royal Canadian Mounted Police, called it a "dynamic, unfolding situation".

Ottawa Hospital said it had received four patients, three of whom were in a stable condition.

Eyewitness Tony Zobl, 35, said he saw the soldier, named as Nathan Cirillo, being shot from his fourth-floor window, directly above the National War Memorial, a 70ft-arched granite cenotaph commemorating the Great War.

"The honour guard dropped to the ground, and the shooter kind of raised his arms in triumph, holding the rifle," Mr Zobl said, adding that the gunman then ran up the street towards Parliament Hill.

Cabinet minister Tony Clement said at least 30 shots were heard inside Parliament, where Conservative and Liberal MPs were holding their weekly caucus meetings.

He said Mr Harper "was addressing caucus, then a huge boom, followed by rat-a-tat shots. We all scattered. It was clearly right outside our caucus door."

A spokesman for Mr Harper said he was safe and had left Parliament Hill. The US Embassy in Ottawa was locked down as a precaution.

Officials also cancelled two events in Toronto honouring Pakistani teenager and Nobel laureate Malala Yousafzai, including one in which she was supposed to receive honorary Canadian citizenship.

US President Barack Obama said the attacks were outrageous and telephoned Mr Harper to offer help and to reassure him of the US people's solidarity with Canada.