A French soldier has been killed in Somalia during a failed operation to free hostage Denis Allex who is also believed to have died, the defence minister said.
Jean-Yves Le Drian told reporters in Paris that a second soldier was missing after the operation.
A battle erupted with al-Shabab militants after commandos swooped on the town of Bulo Marer overnight.
The raid came hours after French troops intervened in the west African state of Mali.
France was “engaged in a merciless fight against terrorism wherever it is found”, Jean-Yves Le Drian said.
The French government knew well the intervention would have dangerous implications for the nine French hostages being held across northern Africa.
Jean-Yves Le Drian said “all the indications” were that hostage Denis Allex, kidnapped in Somalia in July 2009, had been killed by his captors during the operation.
But al-Shabab said Denis Allex, an agent of France’s DGSE intelligence service, was not in the area and was unharmed.
Earlier, the French defence ministry announced that he had been killed. It also said that two French soldiers had died in the fighting, along with 17 militants in the town in the lower Shebelle region.
In a statement, al-Shabab reported a “fierce firefight” that lasted 45 minutes.
Giving no details of its own casualties, the group said it had killed “several” French soldiers and had captured an injured soldier.
The injured soldier would be shown to the press, once security allowed, the group said.
Denis Allex, according to al-Shabaab, was “safe and far from the location of the battle”. An announcement about his fate would be made within two days, the group said, promising “bitter consequences” for the French government.
Residents said at least four civilians including a pregnant woman were killed and others wounded in cross-fire.
They reported seeing the body of a foreign soldier lying on the ground, with helicopters hovering over him.
One unnamed resident said: “Last night while I was sleeping I heard small-arms fire.
“After 10 minutes of shooting, helicopters joined the fight and started firing at targets on the ground, and people on the ground were firing back.
“Nobody could get out of their houses. The helicopters were hovering over the town.”
Of the other French hostages, at least six are being held by the al-Qaeda in the Islamic Maghreb group, AFP news agency reports.
Denis Allex appeared in a video in June 2010, appealing to France to drop its support for the Somali government.
He last appeared in another video in October, looking gaunt and calling on French President Francois Hollande to work for his release.
Somalia has not had an effective central government for more than two decades.
France has a large military base in neighboring Djibouti, including army, marine and air force units.
On Friday, President Francois Hollande announced that French forces were supporting an offensive by the Malian government to regain territory captured by Islamist militants in the north.
It was confirmed that French jets had made air strikes as Islamist rebels were forced out of the town of Konna.
Jean-Yves Le Drian said a French helicopter pilot was killed in the fighting.
Francois Hollande said Islamists had been trying to turn Mali into a “terrorist” state and the French intervention complied with international law and had been agreed with Malian interim President Dioncounda Traore.