Canadian police backed by armored vehicles surrounded parliament in Ottawa on Wednesday after a soldier was shot while guarding a nearby monument.

Witnesses said they saw a gunman running to the parliament building after the shooting.

One witness, Marc-Andre Viau, said he saw a man run into a caucus meeting the parliament, chased by police who yelled "take cover."

That was followed by "10, 15, maybe 20 shots," possibly from an automatic weapon, he said.

Heavily armed police raced to seal off the parliament building and the office of Canadian Prime Minister Stephen Harper.

Harper left the area of the shooting and was "safe," an official said.

The incident came a day after a 25-year-old driver ran over a soldier, killing him before being shot dead by police, in what the government said was a terrorist attack.