"We will not be intimidated. Canada will never be intimidated," Harper said in a brief address to the nation after an attack on the Parliament Hill.
"In fact, this will lead us to strengthen our resolve and redouble our efforts -- and those of our national security agencies -- to take all necessary steps to identify and counter threats and keep Canada safe here at home," the Toronto Star quoted him as saying.
A visibly shaken prime minister said his government will take "all the necessary steps" to keep Canadians safe, without being specific about the measures he plans to take.
Parliament Hill came under attack on Wednesday when a gunman shot and killed a soldier standing guard at the nearby National War Memorial here, before seizing a car and driving to the doors of building's Centre Block.
Heavily armed officers backed by armored vehicles sealed off the Parliament building.
Harper condemned the second "brutal and violent" attack this week, particularly the "cold-blooded murder" of the soldier. He said the incidents were direct attacks on Canadian democracy, values and society.
"This week's incidents are a grim reminder that Canada is not immune to the types of terror attacks we have seen elsewhere around the world," he said.
"Attacks on our security personnel and on our institutions of government are by their very nature attacks on our country, on our values, on our society and on us Canadians," he said.
Ottawa police confirmed shots were fired in 3 locations: the war memorial, inside Centre Block of the Parliament and at the Rideau Centre.
The motive of the attack was not known but it came two days after a recent convert to Islam killed one Canadian soldier and injured another in a hit-and-run before being shot to death by police.
The US Embassy was also locked down after reports of shots being fired. The US and Canadian air defences were placed on heightened alert after the shootings.
Canadian parliament rocked by gunshots; 2 killed
'Nobody has made a film on disability and sexuality in India'
'We're all shaken by it,' says Obama on Canada shooting
India-USA: A friendship that began way back then
HC rejects Indian priest's plea against extradition to US in rape case