Shooting in Canada was second attack in just 3 days

A deadly shooting in Ottawa on Wednesday marked the second attack against soldiers in Canada in three days, leaving experts speculating that terrorists are retaliating against the country for joining the anti-extremist coalition now operating in the Middle East.

Little had been confirmed about Wednesday's attack as of press time except that one soldier had been shot dead, and the suspect in that shooting had been killed. The parliament building was still on lockdown as police, guns drawn, investigated reports of a second shooter in the building.

A video from the Globe & Mail appeared to show police inside a parliament corridor encountering heavy, semi-automatic gunfire. At an afternoon press conference Wednesday, an official with the Royal Canadian Mounted Police (RCMP) said the situation was "dynamic and unfolding."

Several police officers walk near downtown Ottawa on October 22, 2014. Gunfire echoed through the Gothic halls of the Canadian parliament Wednesday as police shot dead a gunman suspected of killing a soldier guarding a nearby war memorial before storming the building.
Lars Hagberg | AFP | Getty Images
Several police officers walk near downtown Ottawa on October 22, 2014. Gunfire echoed through the Gothic halls of the Canadian parliament Wednesday as police shot dead a gunman suspected of killing a soldier guarding a nearby war memorial before storming the building.

However, officials had just confirmed on Tuesday that a terrorist was behind another attack earlier in the week.

Read More Canada PM talking to lawmakers when attack happened

A confirmed jihadist intentionally struck two soldiers Monday with his car in the week's first attack, injuring one and killing the other. Moreover, the quick succession of the two incidents may indicate that more are coming, experts told CNBC.

"I'd be surprised if it was anything other than ISIS [also known as the Islamic State] or al Qaeda," Colin Clarke a terrorism expert with Rand Corp., said of Wednesday's shooting, adding "this could be the beginning of more of these attacks in Europe and the United States."

As for why Canada would be the target of terrorist attacks, experts interviewed by CNBC all pointed to the country's involvement in military operations in the Middle East.

"Obviously the reason they're being targeted is they've been close allies with the United States," said Scott Stewart, vice president of tactical analysis for the geopolitical intelligence firm Stratfor, who explained the nation's deployment to Afghanistan and its involvement in the anti-ISIS coalition make it a target for ideologically motivated terrorists.

Brian Michael Jenkins, who serves as senior advisor to the president of Rand Corp., pointed out that although the identity of the attacker or group involved in Wednesday's shooting is still unknown, there's been long-standing concern that the fight against ISIS would "inevitably inspire attacks."

That's what Canadian officials said inspired Monday's hit-and-run: The man driving the car, identified as Martin Rouleau-Couture, was reportedly arrested earlier this year while trying to fly to Turkey in what authorities speculated may have been an attempt to join a terrorist organization.

After he was gunned down by police, Rouleau was declared a martyr by ISIS.

Read MoreSoldier shot at Canada's war memorial has died

In fact, ISIS has exhorted followers to attack Canadians, especially armed personnel, with cars in the absence of firearms, experts said.

In a September speech, ISIS spokesman Abu Muhammad al Adnani said: "If you can kill a disbelieving American or European—especially the spiteful and filthy French—or an Australian, or a Canadian, or any other disbeliever from the disbelievers waging war, including the citizens of the countries that entered into a coalition against the Islamic State, then rely upon Allah, and kill him in any manner or way however it may be."

The problem Canada faces, experts said, is it has relatively untested counter-terrorism forces and—proportionally—has seen a larger number of residents join or attempt to join ISIS than the United States.

One estimate indicated Canada had seen about 70 citizens go to fight for ISIS (compared to 130 from the U.S.), according Jenkins, though the United States has almost 10 times the population. "There are just so many of these potential grassroots jihadis," Stewart said.

Though Canada and the United States share one of the world's longest demilitarized borders, experts said that the recent attacks did not necessarily portend new dangers for Americans.

Still, Jenkins predicted the discussion of border security may come up in political discussions ahead of the November elections.

Read MoreStocks end lower; oil and Canadian shooting cited

The markets will be watching for more definitive information about whether Wednesday's attack is linked to terrorism.

"The things that scare me are never the things you can predict. However, if it's a lone wolf event, then I think the market will begin to shrug it off," said David Kelly, the chief global strategist for J.P. Morgan Funds.

—CNBC's Ted Kemp contributed to this report.