Millions of dollars earmarked to boost security at Canada’s increasingly threatened diplomatic missions were left unspent over the last three years as the Conservative government chopped programs and staff to eliminate the country's deficit.

The shortfall in capital spending intended to tighten security at embassies, high commissions and consulates prompted an urgent meeting between Foreign Affairs Minister John Baird and his staff within days of the Oct. 22 shooting attack on Parliament Hill.

With Ottawa still shaken by the brazen attack of a lone gunman, Baird raised the issue of unspent security money, asking his staff to expedite a risk-assessment program because of the growing threats posed to diplomats abroad by ISIS (Islamic State in Iraq and Syria) and other terror groups.

Those are the findings of a CBC News investigation, which shows that Foreign Affairs failed to spend almost half of the $129 million budgeted for “strengthening security at missions abroad” in 2013-14, leaving $69 million on the table.

The shortfalls for the previous two years are also sizable. There was $43 million unspent in 2012-13, and $36 million unspent in 2011-12 – even as Canada was closing some key missions abroad because of threats to the security of its staff.

Canada shut down its embassy in Tehran on Sept. 7, 2012, less than a year after an attack on the British Embassy in the Iranian capital. Other Canadian missions in Dhaka, Bangladesh and Cairo were each closed for periods last year because of threats.

Large funding shortfalls

The latest figures for spending shortfalls were published in the Public Accounts of Canada, released late last month, which also reveal lapsed funds in many other departments, amounting to a total of more than $7 billion in savings. The extra money helped the Conservative government pay down the deficit more quickly, leaving room for a $2.5-billion tax break for some families through income splitting.

Retired diplomat Jeremy Kinsman said the world has become a much more dangerous place and Canada's diplomats need protection.

"I don't want to criticize (the Harper government) but it does seem as though it's a management issue and they should not be lapsing money that has been authorized, because a convincing case has been made that it's needed for the safety of Canadians abroad," Kinsman said in an interview from Victoria.

Helen Laverdiere, the NDP's deputy foreign affairs critic, said she is "worried about whether the government is currently doing cuts through the backdoor with the security envelop for our missions abroad."

"I do hope this striving for a balanced budget is not endangering the security of our people abroad."

A spokesman for Foreign Affairs declined to comment on specific security measures, but said the government has allocated more than $650 million since 2007 for mission security and that spending is flexible.

The security program "allows the department the flexibility to adapt to the changing nature of our security needs abroad, as and where needed," John Babcock said in an email.

"The remaining funds were broadly meant for longer-term projects, which we continue to actively consider."

It's not a question of if, it's a question of when. - Steve Day, security consultant

The Harper government in early 2012 paid an international consulting firm, Control Risks Group, almost $2 million to carry out risk assessments at many of Canada's diplomatic missions abroad. The results have not been made public, but security was so top-of-mind that the department budgeted $60 million in capital spending that year for its missions around the world.

Bureaucrats unclear about threats

In the end, Foreign Affairs spent just 60 per cent of that amount. The capital budget for mission security was increased to $103 million the following year, 2012-13, but again the department spent only 41 per cent of the money. That was the same year that U.S. diplomatic compounds in Benghazi, Libya, were attacked, leaving the ambassador and others dead.

Previous to 2011-12, the department earmarked smaller amounts for mission security, but generally spent all the money allotted for the program.

Security consultant Steve Day, formerly head of the elite JTF2 unit of the Canadian Forces, said bureaucrats in Ottawa often don’t appreciate threats around the globe.

"I think where we sometimes run into some challenges is people back in Ottawa looking at those threats and hazards from 5,000 kilometres away don't always appreciate what the threats and hazards on the ground are to embassy staff and personnel," he said in an interview.

"At some point in time, like [the shooting on] Parliament Hill, we're going to have an event. It's not a question of if, it's a question of when."

Foreign Affairs has two main programs for mission security, the Critical Infrastructure Protection Plan, begun in 2007, and Strengthening Security at Missions Abroad, announced in the 2010 budget.

The capital funds for these two programs cover chancery relocations, new residential compounds, physical security upgrades of embassies, and improved vehicles. The department says spending can be adjusted as more urgent needs are identified.

Follow @DeanBeeby and @RosieBarton on Twitter