Denis Allex, a French soldier held hostage in Somalia since 2009, was killed during a raid on Friday night by French troops trying to rescue him, the French defence ministry said on Saturday.
Two other French soldiers and 17 Somalian fighters were killed in the fighting, the ministry said in a statement.
"Faced with the instransigence of the terrorists, who refused to negotiate for three and 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."