Ottawa is in lockdown after a soldier was shot and killed at a war memorial and dozens of shots were fired inside the nearby parliament building.
Police told the AFP news agency that possibly up to three shooters were feared to be on the roof of the building in the capital.
It came after a soldier guarding the nearby National War Memorial was shot and killed, according to an official.
Shots were also fired near the Rideau Centre Mall less than a mile away, police said.
Armed forces bases across the country are being closed to the public in the aftermath of the shooting, CBC TV reported.
Peter Henderson, from Ottawa news service The Wire Report, was one of the first people on the scene.
Speaking to Sky News before it was confirmed the soldier had died, he said: “It was deserted because people had ran away.
“I ran up, looked around to make sure there was no one with a gun coming at me; ran into the middle and saw a young man, clearly a soldier.
“He had been shot multiple times and there was other members of the Canadian forces and bystanders who had rushed to his aid and had begun CPR.
“He was not moving. [The injuries] were as severe as they could possibly have been.”
Mr Henderson spoke to one witness who saw the gunman carefully take aim.
“He said the man came around the corner, walked up, put a rifle on his shoulder, took aim and clearly made a targeted shooting of one of the two members of the honour guard,” he said.
A construction worker at the parliament told the Reuters news agency he heard a gunshot, and then saw a man dressed in black with a scarf over his face running towards the building with a gun.
nother witness said more than 30 shots were fired inside.
Witness Marc-Andre Viau said he saw a man run into a caucus meeting at the parliament, chased by police who yelled “take cover.”
This was followed by “10, 15, maybe 20 shots,” possibly from an automatic weapon, he said.
MP John McKay told reporters: “I literally had just taken off my jacket to go into caucus. I hear this ‘pop, pop, pop,’ possibly 10 shots, (I) don’t really know.”
Video footage posted by the Global and Mail newspaper showed police crouching for cover as they advanced along a stone hallway, with loud gunfire echoing among the gothic columns.
Prime Minister Stephen Harper is safe and has left Parliament Hill.
Some people fled parliament by climbing down scaffolding erected for renovations, witnesses told the Canadian Press news agency.
Police have warned people in Ottawa to stay away from windows and roofs.
The shooting comes two days after an Islamic convert ran down two Canadian soldiers near Montreal, killing one of them.
Authorities had raised the security threat level from low to medium after that incident.