Two French commandos and Denis Allex, a French intelligence adviser held hostage in Somalia since 2009, died during a night commando raid in south Somalia, the French defence ministry said on Saturday.
Two other French soldiers and 17 Somali fighters were killed in the fighting, the ministry said in a statement.
"Faced with the intransigence of the terrorists, who refused to negotiate for three and half years and who were holding Denis Allex in inhumane conditions, an operation was planned and carried out," said the ministry
"During the assault, violent combat took place. Denis Allex was killed by his captors."
Meanwhile, a statement published on a website affiliated with Al Shabab claims that Denis Allex is well and safe in their hands.
The group said in this statement that it would decide Mr. Allex's fate in two days time.