A French commando raid in Somalia to free a captive intelligence agent has ended in the deaths of 17 Islamists and a French soldier.

France's defence minister said the hostage also died in the failed rescue, but the man's captors said that he remained alive, and claimed to have seized a second soldier.

Confusion surrounded early reports of the botched rescue of the agent, known by his code name Denis Allex.

He was captured on 14 July 2009 and last seen in a video released in October pleading for the French president to help him.

The militant Islamist group al-Shabaab, which held Mr Allex for more than three years, said today that he remained alive and in its custody.

It claimed that it also has a new captive, a French commando injured in fighting.

The Governor of Lower Shabelle region of Somalia Abdiqadir Mohamed Sidii said that the Somali government was aware of the dawn operation and the fact that the raid caused casualties.

Al-Shabaab officials said some soldiers were killed, but the group held only one dead French soldier.

Later, al-Shabaab released a statement saying that Mr Allex "remains safe and far from the location of the battle". The group said there would be a verdict in his case in two days.

Residents of Bulomarer described hearing explosions and gunfire from what they called an al-Shabaab base.

An al-Shabaab official said that fighting began after helicopters dropped off French soldiers.

Mr Allex was kidnapped from a hotel in Somalia's capital, Mogadishu on 14 July 2009 with a colleague who later escaped.

They were in Somalia to train government forces who are fighting Islamist militiamen.