The United States and Canada vowed Tuesday to step up already close counterterrorism and border security cooperation as U.S. Secretary of State John Kerry paid condolences to the Canadian people following last week's terror attacks.

On his first trip to Canada since taking office, Kerry flew to Ottawa and went immediately to the National War Memorial to lay a wreath in honor of Cpl. Nathan Cirillo, the Canadian soldier slain there by a gunman believed to have been inspired by the Islamic State group. The attack on Wednesday was the second in three days in Canada, after an earlier incident in Quebec.

"There is nowhere safe for those who would pervert the teachings of a great religion, betray their neighbors and line up on the side of such pernicious groups such as al-Qaida and ISIL," Kerry told reporters after meeting Canadian Foreign Minister John Baird.

"Together, on this side of the Atlantic and where necessary overseas, we will defeat the advocates and practitioners of terror, expose their hypocrisy and we will win the battle of ideas," he said.

Standing beside Kerry, Baird stressed Canada's resolve in fighting extremism.

"We cannot allow there to be a safe haven for this medieval savagery, or a launchpad for attacks on our home soil," Baird said.

The pair of attacks in Canada have prompted concerns among some in the U.S. over security along the world's longest undefended border. But Baird noted that there has never been a successful terrorist attack across either border and officials traveling with Kerry said that while there is always room for improvement, Washington is satisfied with the current state of cooperation with Ottawa on the matter.

That said, Kerry pointed out that the U.S. and Canada "are always looking at ways to cooperate more" and would "continue to intensify our law enforcement, border security and intelligence sharing." He did not elaborate.

The officials with Kerry said there were virtually no areas of disagreement between the neighbors on big international issues, including the fight against extremism, the effort to halt the spread of the deadly Ebola virus and the crisis in Ukraine.

Indeed, on Ukraine both Kerry and Baird commended the country on its recent parliamentary elections and demanded that Russia halt any intervention in the east, where Kerry said the U.S. would not recognize planned upcoming elections in areas held by pro-Russian separatists.

During his brief visit, Kerry will also see Canadian Prime Minister Stephen Harper and meet with members of Parliament.

One area of U.S.-Canadian friction — delays and uncertainty in the Obama administration's decision over the controversial Keystone XL pipeline — was raised in Kerry's meeting with Baird, both men said. But each played down dissension on the matter.

Kerry said a State Department review of the project was still pending and that while he would like to make a decision on it "sooner rather than later," he would not do so until due diligence had been paid to its pros and cons. The pipeline, much wanted by Canada and supported by conservatives in the U.S., is fiercely opposed by many environmental groups.

Baird said the pipeline issue was "important" for Canada and that appreciated the seriousness with which the review is being taken.