At least one of the two Canadians who took part in a deadly attack on an Algerian gas plant had worked at the facility, CBC News has learned.

Militants took control of the Tigantourine gas plant near Ein Amenas, Algeria, on Jan. 16. After a four-day hostage standoff, Algerian special forces stormed the facility. More than 80 people were killed in the violence.

An extremist group called the Masked Brigade claimed responsibility, saying it was retaliation for Algeria's support of France's miiltary offensive against Islamist insurgents in neighbouring Mali.

Two young men from London, Ont., 22-year-old Xristos Katsiroubas and Ali Medlej, who was about 24 years old, are believed to have died fighting alongside the militants during the refinery attack.

The pair travelled to Morocco in 2011 with Aaron Yoon, another young man from London. All three made their way to Mauritania, where Yoon is currently imprisoned.

A CBC News investigation has learned that Medlej was briefly detained in Mauritania in the late fall of 2011, suspected of plotting an attack. He was briefly questioned, held for 40 days and released without charges. Those who interrogated Medlej found him to have no ill intent and no malice, but they seem to have seriously misread the young Canadian’s objective.

Sources at the jail in Nouakchott, the Mauritanian capital, say that as soon as Medlej was released in early 2012 he went to find work at the gas plant in Algeria, where he would be killed a year later.

It seems his role was to scout the facility. He then travelled to militant training camps in Mali to help draw up the plans of attack, sources say.

- Read CBC's original story on Xristos Katsiroubas and Ali Medlej

- Recent terrorism-related cases with Canadian connections

That assessment fits with Mauritanian security analyst Isselmou Ould Moustapha’s view of the attack. Targeting such a large piece of infrastructure as the Ein Amenas plant would have required “good information about what is happening there. Where are the doors, where are the windows, where are the people living?” he said.

“They had the information. They had solid complicity.”

Canadian sources confirmed that at least one of the Canadians worked at the plant, but it's possible that both had been employed there. Several reports suggest a number of the hostage-takers were familiar with the facility.

Training the attackers

Logistical planning for such an attack would have been intricate, but training the militants to kill may not have been a long process, Moustapha said.

He estimates that, according to his sources, Medlej and Katsiroubas would have been in the northern Mali training camps for between two weeks to two months starting in the fall of 2012.

Yoon, the young man who travelled to Mauritania with Katsiroubas and Medlej in 2011, was arrested in December of that year for allegedly having ties to a terrorist group, and remained imprisoned in Nouakchott when his two friends would have departed for Mali.

Yoon, who has always maintained his innocence, received a two-year sentence after authorities suspected him of trying to visit militant training camps. His trial and sentencing happened before the Algeria attack, and before Mauritanian officials understood that Yoon was friends with Medlej and Katsiroubas.

Mauritanian prosecutors have now asked for a retrial for Yoon and several others imprisoned on terrorism-related convictions. A hearing is scheduled for next week. Prosecutors feel the sentences weren’t strict enough and it seems they have new questions.

- Learn about Canadians who have 'fallen prey' to Islamic extremism

A judge could choose to release Yoon, reduce his sentence or order him to serve more time behind bars. Yoon, who has always maintained his innocence, has turned down previous offers of legal help. But a human rights worker dealing with his case said Yoon’s attitude is shifting and he may now realize he needs a good lawyer.

Searching for clues in Mauritania

A team from CBC News spent a week attempting to retrace the steps of the three Canadians after they arrived in Mauritania.

It seems they made curious choices. Instead of staying at one of the well-known, inexpensive backpacker hotels popular with young travellers and students, they opted for a guesthouse in the centre of what police call a criminal hub.

It’s a neighbourhood that extremists are known to frequent, where the tension is palpable. It’s not the sort of place you find in a travel book, suggesting that someone may have guided them there.

The contacts that the trio made and the places they went all suggest someone was on hand to give them advice. Just who that person is counts among the many secrets the desert isn’t quite willing to give up yet.

Earlier on HuffPost:

Loading Slideshow...
  • An unidentified rescued hostage speaks to the media in a hospital Ain Amenas, Algeria, in this image taken from television Friday Jan. 18, 2013. Algeria’s state news service says nearly 100 out of 132 foreign hostages have been freed from a gas plant where Islamist militants had held them captive for three days. The APS news agency report was an unexpected indication of both more hostages than had previously been reported and a potentially breakthrough development in what has been a bloody siege. (AP Photo/Canal Algerie via Assiaciated Press TV) ** TV OUT ALGERIA OUT **

  • Unidentified rescued hostages pose for the media in Ain Amenas, Algeria, in this image taken from television Friday Jan. 18, 2013. Algeria’s state news service says nearly 100 out of 132 foreign hostages have been freed from a gas plant where Islamist militants had held them captive for three days. The APS news agency report was an unexpected indication of both more hostages than had previously been reported and a potentially breakthrough development in what has been a bloody siege. (AP Photo/Canal Algerie via Associated Press TV) ** TV OUT ALGERIA OUT **

  • Algerian special police unit officers secure the hospital in Ain Amenas, Algeria, Friday, Jan. 18, 2013, two days after the start of the terrorist attack at a gas plant. The hostage crisis in the remote desert of Algeria is not over, Britain said Friday, after an Algerian raid on the gas plant to wipe out Islamist militants and free their captives from at least 10 countries unleashed bloody chaos. (AP Photo/Anis Belghoul)

  • An unidentified rescued hostage receives treatment in a hospital in Ain Amenas, Algeria, in this image taken from television Friday Jan. 18, 2013. Algeria’s state news service says nearly 100 out of 132 foreign hostages have been freed from a gas plant where Islamist militants had held them captive for three days. The APS news agency report was an unexpected indication of both more hostages than had previously been reported and a potentially breakthrough development in what has been a bloody siege. (AP Photo/Canal Algerie via Associated Press TV) ** TV OUT ALGERIA OUT **

  • An unidentified rescued hostage speaks to the media in a hospital in Ain Amenas, Algeria, in this image taken from television Friday Jan. 18, 2013. Algeria’s state news service says nearly 100 out of 132 foreign hostages have been freed from a gas plant where Islamist militants had held them captive for three days. The APS news agency report was an unexpected indication of both more hostages than had previously been reported and a potentially breakthrough development in what has been a bloody siege. (AP Photo/Canal Algerie via Associated Press TV) ** TV OUT ALGERIA OUT **

  • This image from video provided by the SITE Intel Group made available Thursday Jan. 17, 2013, purports to show militant militia leader Moktar Belmoktar. Algerian officials scrambled Thursday Jan. 17, 2013 for a way to end an armed standoff deep in the Sahara desert with Islamic militants who have taken dozens of foreigners hostage, turning to tribal Algerian Tuareg leaders for talks and contemplating an international force. The group claiming responsibility — called Katibat Moulathamine or the Masked Brigade — says it has captured 41 foreigners, including seven Americans, in the surprise attack Wednesday on the Ain Amenas gas plant. Algerian Interior Minister Daho Ould Kabila said the roughly 20 well armed gunmen were from Algeria itself, operating under orders from Moktar Belmoktar, al-Qaida's strongman in the Sahara. (AP Photo/SITE Intel Group) THE ASSOCIATED PRESS HAS NO WAY OF INDEPENDENTLY VERIFYING THE CONTENT, LOCATION OR DATE OF THIS PICTURE. MANDATORY CREDIT: SITE Intel Group

  • This April 19, 2005 photo released by Statoil via NTB scanpix, shows the Ain Amenas gas field in Algeria, where Islamist militants raided and took hostages Wednesday Jan. 16, 2013. As Algerian army helicopters clattered overhead deep in the Sahara desert, Islamist militants hunkered down for the night in the natural gas complex they had assaulted Wednesday morning, killing two people and taking dozens of foreigners hostage in what could be the first spillover from France's intervention in Mali. (AP Photo/Kjetil Alsvik, Statoil via NTB scanpix) NORWAY OUT

  • This April 19, 2005 photo released by Statoil via NTB scanpix, shows the Ain Amenas gas field in Algeria, where Islamist militants raided and took hostages Wednesday Jan. 16, 2013. As Algerian army helicopters clattered overhead deep in the Sahara desert, Islamist militants hunkered down for the night in the natural gas complex they had assaulted Wednesday morning, killing two people and taking dozens of foreigners hostage in what could be the first spillover from France's intervention in Mali. (AP Photo/Kjetil Alsvik, Statoil via NTB scanpix) NORWAY OUT

  • JGC Corporation, or Nikki Manager of public relations Takeshi Endo, foreground, answers reporters' questions following Wednesday's attack at a natural gas complex in Algeria which involves the company's workers, at its headquarters in Yokohama, near Tokyo Thursday, Jan. 17, 2013. A militant group that claimed responsibility said 41 foreigners were being held after the assault on one of oil-rich Algeria's energy facilities. Two foreigners were killed. (AP Photo/Kyodo News) JAPAN OUT, MANDATORY CREDIT, NO LICENSING IN CHINA, HONG KONG, JAPAN, SOUTH KOREA AND FRANCE

  • Helge Lund

    Statoil Chief Executive Helge Lund answers questions about the situation in the gas field, jointly operated by BP, the Norwegian energy company Statoil and the Algerian state oil company Sonatrachfield along with Japanese company JGC Corp., in Ain Amenas in Algeria during a press briefing in Stavanger, Norway, Thursday, Jan. 17, 2013. In a desert standoff deep in the Sahara, the Algerian army ringed the natural gas complex where Islamist militants hunkered down with dozens of hostages Wednesday night after a rare attack that appeared to be the first violent shock wave from the French intervention in Mali. (AP Photo/NTB Scanpix, Kent Skibstad) NORWAY OUT

  • Helge Lund

    Statoil Chief Executive Helge Lund answers questions about the situation in the gas field, jointly operated by BP, the Norwegian energy company Statoil and the Algerian state oil company Sonatrachfield along with Japanese company JGC Corp., in Ain Amenas in Algeria during a press briefing in Stavanger, Norway, Thursday, Jan. 17, 2013. In a desert standoff deep in the Sahara, the Algerian army ringed the natural gas complex where Islamist militants hunkered down with dozens of hostages Wednesday night after a rare attack that appeared to be the first violent shock wave from the French intervention in Mali. (AP Photo/NTB Scanpix, Kent Skibstad) NORWAY OUT

  • STATOIL

    Statoil spokesman Ole Anders Skauby, centre right, talks to TV reporters outside Scandic Bergen Airport hotel where a drop-in center is established for relatives of hostages involved in the situation in Algeria. Militants are holding a number of foreigners hostages in the Sahara desert in revenge for Algeria's support of French efforts to remove Islamists from control of neighboring northern Mali. (AP Photo / Hakon Mosvold Larsen / NTB scanpix) NORWAY OUT

  • An unidentified rescued hostage receives treatment in a hospital Ain Amenas, Algeria, in this image taken from television Friday Jan. 18, 2013. Algeria’s state news service says nearly 100 out of 132 foreign hostages have been freed from a gas plant where Islamist militants had held them captive for three days. The APS news agency report was an unexpected indication of both more hostages than had previously been reported and a potentially breakthrough development in what has been a bloody siege. (AP Photo/Canal Algerie via Assiaciated Press TV) ** TV OUT ALGERIA OUT **

  • Residents of Ain Amenas, Algeria, gather outside the hospital trying to get information concerning relatives wounded during the terrorist attack at the gas plant, Friday, Jan. 18, 2013. The hostage crisis in the remote desert of Algeria is not over, Britain said Friday, after an Algerian raid on the gas plant to wipe out Islamist militants and free their captives from at least 10 countries unleashed bloody chaos. (AP Photo/Anis Belghoul)

  • Screen shot 2013-01-18 at 14

  • Screen shot 2013-01-18 at 14

  • Screen shot 2013-01-18 at 14