Prime Minister Stephen Harper is safe and secure and has been removed from Parliament Hill, the government said.
Shots were fired at the National War Memorial and in Parliament's Centre Block on Wednesday morning, Ottawa police said, at a time when MPs gather on the Hill for their weekly caucus meetings.
"The Prime Minister is safe and not on Parliament Hill and being briefed by security officials," Jason MacDonald, director of communications in the Prime Minister's Office, said in a statement.
"Our thoughts and prayers are with the families of those who were attacked."
The Prime Minister's Office declined to divulge Mr. Harper's location for security reasons.
It's not clear how Mr. Harper was moved off Parliament Hill, but the PMO has access to a motorcade and former staffers say they believe there are tunnels running across Wellington Street to Langevin Block, the Prime Minister's Office.
The Parliament Buildings and federal government offices were put into lockdown, as well as nearby buildings such as those at the University of Ottawa.
Mr. Harper spoke to Official Opposition Leader Thomas Mulcair and Liberal Leader Justin Trudeau, saying he was thankful they are safe.
"While the Prime Minister stated that facts are still being gathered, he condemned this despicable attack," Prime Minister's Office press secretary Carl Vallée said.
"The Prime Minister reiterated the importance of the continued functioning of the government and our Parliament."
The Prime Minister's Office says Mr. Harper's planned events in Toronto are cancelled for Wednesday.
Mr. Harper was set to meet with Malala Yousafzai, who recently won the Nobel Peace Prize, to grant her honorary Canadian citizenship. He was also set to announce a funding commitment for the Global Partnership for Education, an organization whose work Ms. Yousafzai strongly supports.