Secretary of State John Kerry says the U.S promises to work even more closely with the Canadian government to prevent attacks such as those that occurred in Ottawa and Quebec last week.

"President Obama, the State Department and our entire administration pledge to work even more closely with your leaders at every level in order to deter and prevent terrorist attacks," said Kerry during a speech in Ottawa on Tuesday.

​Kerry, who is in Ottawa for bilateral meetings with Foreign Affairs Minister John Baird, is also meeting with select MPs and Prime Minister Stephen Harper before returning to Washington.

The secretary of state said the U.S. and Canada would "work quietly and carefully in the next days and months" to strengthen security between the two countries "in the same fashion that we work on almost every challenge that we face together."

"Canada and the United States are now in discussions — not with any sense that things weren't done, or that there is some information that we didn't somehow share or have — but rather with a view to making certain that every possible stone is turned over, every possible policy is reviewed because our obligation is obviously to protect our citizens," Kerry said in Ottawa on Tuesday.

"We will continue to have vigilance and aggressively take every step possible to do that. And we will continue to intensify our law enforcement, border protections and intel-sharing relationship and efforts to do that."

"I'm confident that we will come up with some tweaks, some changes, some additions that will promote even greater security than we have today," Kerry said.

'Canada Strong'

Kerry compared last week's attacks in Canada to the Boston Marathon bombings in his Massachusetts hometown 18 months ago. 

The bombings claimed the lives of three people and wounded hundreds more, but Kerry said Americans emerged stronger and more resilient than ever, backed by the support of their allies. 

And just as the world rallied behind the slogan "Boston Strong," Kerry said similar "echoes" emanated from Canada this week: "Ottawa Strong, Quebec Strong, Canada Strong."

The secretary of state said that "adversaries" who would "instil terror" will be defeated by a coalition of countries on this side of the Atlantic and overseas.

"We will defeat the advocates and practitioners of terror, expose their hypocrisy and we will win the battle of ideas," Kerry said.

"There is nowhere safe for those who would pervert the teachings of a great religion, murder the innocent, betray their neighbours and lie on the side of such pernicious groups as the Islamic State of Iraq and the Levant​ and al-Qaeda."

Kerry expressed his condolences for the loss of two Canadian soldiers — Cpl. Nathan Cirillo and Warrant Officer Patrice Vincent — killed in two separate attacks in Canada last week.

He also commended the work of first responders and law enforcement officials who took quick action to prevent further harm. He also applauded Sergeant-at-Arms Kevin Vickers for his role in ending the Ottawa shooting.

"Great nations, like great individuals, are those who are made stronger by the hardest tests of life. In the past week, the world has been witness to Canada's strength. To your unity, your courage, your resolve," Kerry said in Ottawa.

He began his visit to Ottawa by laying a wreath for Cpl. Cirillo at the National War Memorial.

John Kerry laid a wreath in Ottawa3:04

Iraq, Keystone, Ebola on agenda

In a scrum with reporters during the flight to Ottawa, senior state department officials said Kerry's message of condolence to Canadians in the aftermath of "two terrorist attacks" last week is that "the American people have been through incidents like this before, and we stand beside you."

"We know how difficult this is, but we also know how strong Canada is as a nation, and the Canadian people are, and you have a close friend right across the border," officials said.

Americans are working closely with Canadian officials on the challenge of stopping North American citizens from leaving to become foreign fighters in places like Syria, they said.

The leaders are expected to discuss their joint military efforts to fight ISIS in northern Iraq, however "we don't have specific asks on that," the U.S. officials told the travelling media.

The officials also told reporters Canada has "stepped up considerably" in its contribution to the international efforts to fight the Ebola outbreak.

They said the controversial Keystone XL pipeline "has tended to come up in Secretary Kerry's meetings with his Canadian counterparts," but that there also have been meetings lately in which it has not been raised. They said there was a "decent likelihood" it would come up Tuesday.

Visit to show 'solidarity'

Cirillo was shot and killed while guarding the Tomb of the Unknown Soldier last Wednesday. The gunman, Michael Zehaf-Bibeau, then ran to Parliament Hill carrying a gun before being killed by Sergeant-at-Arms Kevin Vickers and his security team inside Centre Block. Cirillo's funeral was held today in Hamilton.

The Ottawa attack came just two days after Warrant Officer Patrice Vincent was hit by a car in a targeted hit-and-run in St-Jean-sur-Richelieu in Quebec. The attacker in that incident was identified as Martin Couture-Rouleau, a suspected extremist whose passport had been seized earlier this year.

Baird and Kerry last met in New York on Sept. 24 at the Transatlantic Dinner, and spoke by phone last week.

U.S President Barack Obama and Harper spoke by phone last Wednesday after the attack in Ottawa.

With files from Susana Mas, Meagan Fitzpatrick