One was handed over to the al-Shabab movement, which has vowed to overthrow the government, and the other was given to members of the allied Hizb ul-Islam.

The French agents were in the country to train Somali government forces and the armed opposition movments had threatened to put them on trial for spying and conspiracy against Islam.

Local media reported at the time of the abduction that the pair had been posing as journalists.

Kidnappings are common in Somalia and captives are often released after the payment of substantial ransoms.

However, the French foreign ministry said that "officially, France does not pay ransoms".

The government of Sharif Ahmed, the president, controls only small parts of the country's central region and a few districts of Mogadishu.

He called on the armed opposition to observe a ceasefire during the Muslim holy month of Ramadan which started last week, but they have dismissed the call, saying the president is planning to use any truce to rearm his forces.