Did authorities miss a chance to keep Canadian out of deadly Algerian terror attack?

The War on Terror often is a story of missed opportunities.

Even as the hunt for the remaining suspect in the Boston Marathon bombings pushes forward, American authorities will be trying to piece together the movements of the attackers in the weeks and months leading up to the attack.

They'll want to know if these suspects were on the radar, anywhere. If there was any good intelligence about them that could have prevented last weekend's carnage. The "if only" factor.

Probably there'll be some of that second-guessing after news that one of two Canadian home-grown terrorists killed in January's deadly attack on an Algerian gas plant could have avoided his deadly fate.

CBC News has discovered Ali Medlej, one of four young men from London, Ont., thought to have left Canada to become jihadists, was in custody in the African country of Mauritania a year ago. But he was released by authorities without Canadian officials even knowing he'd been arrested.

Medlej, 24, and his his high-school buddy Xristos Katsiroubas died during the four-day takeover of the facility in the Algerian desert by a group believed to be connected with al Qaeda. The attack left 37 hostages and 29 jihadist fighters dead. Authorities believe the two Canadians blew themselves up as Algerian forces retook the plant.

[ Related: Fourth Canadian sought following Algeria attack ]

According to sources tapped by CBC News, Medlej and another Canadian, Aaron Yoon, were arrested in a roundup of suspected al Qaeda supporters in late 2011.

Yoon, another classmate of Medlej, is still in jail after being sentenced last year to two years for being associated with a terrorist organization. He has denied any terrorist involvement or connection to the Algerian attack.

But CBC News learned Medlej was freed after spending 40 days in custody and being interrogated by Mauritanian investigators. He was, according to CBC, simply released into the desert of the West African country and just slipped away.

The CBC investigation discovered Canadian diplomats, who are normally informed when a citizen is in foreign custody, were never told the Mauritanians had arrested Medlej, neither by officials there nor his family in Canada.

By the time they found out, Medlej had vanished, presumably to connect with the group that ultimately attacked the gas plant in neighbouring Algeria.

So, did someone drop the ball, as the CBC story suggests? Would a call from Mauritanian officials to their Canadian counterparts have changed Medlej's fatal path?

[ Related: Friend of Canadians in Algerian attack studied at Mauritanian religious school ]

According to CBC News, both the Canadian Security Intelligence Service (CSIS) and the RCMP were looking into the young men before they left Canada.

CSIS agents apparently interviewed their family, friends and acquaintances as far back as 2007, when they were still in their teens. The RCMP began a criminal investigation and conducted interviews last year, after the group had left the country.

The post-mortem review of how those agencies handled their files on the London group probably won't be made public, so we may never learn what, if any, mistakes were made.

But the problem for police and intelligence organizations is that the resources they'd need to track every young Canadian who spent time on a jihadist web site or lent a sympathetic ear to a known militant would have to be immense.

As CBC News said in its story, police had no grounds to step in because the young men had done nothing wrong here. And tracking their movements once they left Canada became even more difficult.

A call to Canadian authorities from someone in Mauritania or a member of Medlej's family might not have prevented the Algerian attack but it might have kept him in custody like Yoon.