"In the end, it will be the French citizens who will inevitably taste the bitter consequences of their government's devil-may-care attitude towards hostages," the Islamists said in a statement obtained by Agence France-Presse (AFP).
A French secret service Denis Allex hostage was being held in southern Somalia since 2009, the French defence minister said Saturday.
The overnight operation was launched by France's elite General Directorate for External Security (DGSE) secret service, Defence Minister Jean-Yves Le Drian said in a statement, adding that the raid was sparked by the "intransigence of the terrorists who have refused to negotiate for three and a half years and were holding Denis Allex in inhuman conditions."
But the al-Shabab extremists denied Le Drian's assertion that they had killed the hostage, a secret agent whose alias is Denis Allex, adding that they would decide his fate in two days and issuing a stern warning to Paris.
Two French soldiers "lost their lives (and) 17 terrorists were killed" in the battle, Le Drian said, offering the "most sincere condolences" to the dead soldiers' families and praising the men for their "courage and remarkable work".
He said the families of the dead soldiers had been informed.
A al-Shabab statement said "in the end, it will be the French citizens who will inevitably taste the bitter consequences of their government's devil-may-care attitude towards hostages."
Sheikh Mohamed Abdallah, a local al-Shabab military commander, told AFP: "Mujahedeen fighters defeated the so-called commandos of the French government who tried to rescue a hostage, and they (the commandos) left the bodies of several of their own at the site of the attack."
Abdallah is the commander of Bulomarer, where the raid allegedly took place.
The Shabab statement said the French carried away "several" of their dead.
Hostages and the help needed
"The helicopters attacked a house … upon the assumption that Denis Allex was being held at that location, but owing to a fatal intelligence blunder, the rescue mission turned disastrously wrong.
"Several French soldiers were killed in the battle and many more were injured before they fled from the scene of battle, leaving behind some military paraphernalia and even one of their comrades on the ground.
"The injured French soldier is now in the custody of the mujahedeen and Allex still remains safe and far from the location of the battle."
A Bulomarer resident, Idris Youssouf, told AFP: "We don't know exactly what happened because the attack took place at night, but this morning we saw several corpses including that of a white man.
"Three civilians were also killed in the gunfight," he said.
The French secret agent was kidnapped in Somalia in July 2009 along with a colleague who was freed the following month.
Four military helicopters were used in the raid in Shabab-controlled Bulomarer, some 110 kilometres south of the Somali capital Mogadishu, witnesses said.
The Al-Qaeda linked Shebab lost their main strongholds in the south and centre of the country following an offensive launched in mid-2011 by an African Union force, but they still control some rural areas.
Allex is among nine French hostages in Africa of whom at least six are held by Al-Qaeda in the Islamic Maghreb (AQIM).
He appeared in a video in June 2010 appealing to Paris 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 since 1991. However, a new administration took office last year, ending eight years of transitional rule by a corruption-riddled government.
Over a million Somalis are displaced inside the country while over a million are refugees in neighbouring nations, according to UNited Nations (UN) figures.
The UN this month appealed for $1.3 billion to support 3.8 million people – about half the population of the war-torn country.
In 2011, famine in the country caused by extreme drought exacerbated by conflict and claimed tens of thousands of lives and affected more than four million people, according to the UN. – AFP.