A French soldier has been killed in Somalia during a failed operation to free a hostage 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", Mr Le Drian said.
It seems likely that the operation was linked to the intervention in Mali, the BBC's Hugh Schofield reports from Paris.
The French government knew well the intervention would have dangerous implications for the nine French hostages being held across northern Africa, our correspondent says.
Mr 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 Mr 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 firelight" 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.
Mr 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 told the BBC that 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.
Mr 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 neighbouring Djibouti, including army, marine and air force units.
On Friday, President Hollande announced that French forces were supporting an offensive by the Malian government to regain territory captured by Islamist militants in the north. - BBC