Somali militants linked to al-Qaeda say they have executed French agent, Denis Allex, days after a botched rescue attempt which resulted in the deaths of two French commandos.

Denis Allex was one of two officers from the French intelligence agency kidnapped by al-Shabaab in Mogadishu

Al-Shabaab rebels have said the death sentence imposed on Denis Allex was to avenge what it called France's growing persecution of Muslims and its military operations around the world against Islamists, including in Mali.

"Let Muslims enjoy his execution and the French cry," Sheikh Abdiasis Abu Musab, al-Shabaab's spokesman for military operations, told Reuters by telephone.

The militants said Allex, held hostage since mid 2009, had been killed at 16.30 GMT on Wednesday.

France said that Allex was killed in Saturday's failed rescue mission when helicopter-borne French troops swooped into southern Somalia under the cover of darkness.

The raid, in which two French commandos were killed, coincided with the launch of French air strikes against Ismalist rebels in Mali in West Africa.

The Paris government had been concerned the lives of various French hostages held in Africa would be at risk if it intervened militarily against the al-Qaeda-aligned combatants in Mali, but said on Saturday the two military operations were not connected.

Read more: Where in the world is al-Qaeda?

'Unanimous' decision

Al-Shabaab's decision to kill Allex had been unanimous, it said on Wednesday, in light of France's military operations in Afghanistan and Mali and support for "African invaders in Muslim lands".

Troops from Uganda, Burundi, Kenya and Ethiopia are battling al Shabaab on several fronts in Somalia and have forced the rebels to give up significant territory in southern and central areas of the Horn of Africa country.

The militants, who formally merged with al-Qaeda in February last year, launched their campaign against the government in early 2007, seeking to impose sharia, or Islamic law, on the entire country.

Allex was one of two officers from the French intelligence agency kidnapped by al-Shabaab in Mogadishu in July 2009. His colleague, Marc Aubriere, escaped a month later but Allex had been held ever since.

Where in the world is al-Qaeda? See our map

After Allex's abduction, al-Shabaab issued a string of demands. These included an end to French support for the Somali government and a withdrawal of the 17,600-strong African peacekeeping force propping up the UN-backed administration.

In October, the militants uploaded a video of Allex pleading with French President Francois Hollande to negotiate his release and save his life.

There was no immediate comment from France after al-Shabaab's statement it had carried out the execution.

Hollande said on Wednesday he took responsibility for the failed rescue of Allex. He said, however, he stood by the operation because it sent out a message France could not accept its nationals being taken hostage.