Three shooting incidents are being investigated in Ottawa - after a Canadian soldier was injured at the National War Memorial.
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.
One guman has been shot dead inside the parliament building.
The soldier was guarding the nearby National War Memorial when he was shot and wounded. He was treated at the scene but died of his wounds, according to an official quoted by AFP.
"Condolences to family of the soldier killed and prayers for the parliamentary guard wounded. Canada will not be terrorized or intimidated," employment minister Jason Kenney wrote on Twitter.
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.
Another 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.