French secret agent Denis Allex
French secret agent Denis Allex in a video released by his abductors (YouTube)

A French secret agent held hostage in Somalia has been killed during a failed attempt to free him, according to France's ministry of defence. However, his abductors claim he is still alive and in their hands.

The operation was conducted by a commando unit attached to the General Directorate for External Security (DGSE), the French equivalent of MI6, backed by helicopters.

"We have reason to believe that unfortunately Denis Allex [the hostage] was killed by his captors," French defence minister Jean-Yves Le Drian said.

One French soldier and 17 terrorists also lost their lives during a night raid in the town of Bulo Marer, the French defence ministry stated.

Another soldier, at first reported dead, is now missing; terrorists claim he is in their "custody".

Bulo Marer, 110 km south of the capital Mogadishu, is a stronghold of militant Islamist group al-Shabaab.

"The DGSE commandos faced strong opposition as violent fights erupted during the assault," the defence ministry said.

"Five helicopters attacked a house in the town. They dropped soldiers off, so that they could reach their destination... but fighting has broken out," a local resident said.

"We don't know exactly what happened," another man living in Bulo Marer told AFP. "But this morning we saw several corpses, including that of a white man."

Al-Shabaab, however, denies the French claims. It says Alex was not killed during the night raid, as he was not in the building targeted by French commandos.

"Allex still remains safe and far from the location of the battle," said al-Shabaab in a statement.

The terrorist group also said they captured an injured French soldier who was "left on the ground" during the commandos' retreat.

"Many [Soldiers] 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 Mujahideen," al-Shabaab said.

Allex, whose name is believed to be an alias, was working for the DGSE when he was kidnapped by al-Shabaab terrorists in July 2009.

He was abducted at the same time as another Mogadishu-based DGSE agent, who was freed after a month.

In October 2012, a video showing a pale Allex calling for French President François Hollande to push for his release was distributed by al-Shabaab.

According to analysts, the DGSE operation to free Allex was a consequence of France's intervention against the military advance of Islamist groups linked to al-Qaida in Mali.

France's action in Mali could have endangered the lives of several hostages held in Africa by other al-Qaida-linked groups, such as al-Shabaab and al-Qaida in the Islamic Maghreb (AQMI).

AQMI is believed to be holding at least other six French hostages captive.

However, the French defence minister denied any link with his country's actions in Mali.

"The life of all hostages was at stake yesterday, is at stake today and will continue to be so tomorrow," Le Drian said.