A French hostage and two French soldiers have been killed during a failed secret service rescue mission in Somalia.

The failure of the overnight helicopter raid in the southern town of Bulo Marer, about 70 miles south of Mogadishu, came as the French military continued a separate African operation in Mali.

The French defence ministry said the hostage was a member of the secret service, the General Directorate for External Security (DGSE), which directed the operation.

The ministry said the agent, known by his pseudonym Denis Allex, was killed by his captors, members of the Islamist group al-Shabaab, who mounted stiff resistance to the French forces' operation. Seventeen fighters from the group, which had held Allex hostage for three years, were also killed.

In a bloody day for French forces, the ministry also announced that a combat pilot had been killed after his helicopter was shot down in the rapidly escalating military intervention in Mali, where France is supporting the government effort to seize back the north of the country from Islamist rebels.

French military officials said on Saturday that air strikes overnight in Mali drove back Islamist rebels from the city of Konna and destroyed a militant command centre.

Despite the announcement of Allex's death in Paris, a spokesman for al-Shabaab claimed he remained alive and in their custody and would face trial in two days. The group said it had also captured a wounded French commando. Neither claim could be independently verified.

The French defence ministry said Allex had been kidnapped in Somalia in July 2009 along with a colleague who escaped the following month.

In a statement, it said: "The DGSE commando force encountered strong resistance and in the course of the attack, which saw heavy combat in places, two soldiers [also] lost their lives."

The ministry said the decision to launch the rescue mission had been taken after there had been no progress in three years of attempted negotiations to secure his release.

Bulo Marer residents described a noisy scene of explosions and gunfire during the raid. The attack was swift and loud, they said.

"We heard a series of explosions followed by gunfire just seconds after a helicopter flew over the town," said Mohamed Ali. "We don't know exactly what happened but the place was an al-Shabaab base and checkpoint."

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

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

He said some soldiers were killed, but the group held only one dead French soldier. "We had mujahideen fighters already deployed there who fought back the French soldiers. We killed some of their soldiers but only one dead soldier in a French military uniform is in our hands now."

On Friday French troops began military operations in Mali, including air strikes, to contain Islamist groups linked to al-Qaida, which are continuing to clash with the army in a fight for control of the desert in the north of the country.

Admiral Edouard Guillaud said the pilot of the downed French helicopter died of his wounds while he was being evacuated to safety.

A military official in Mali said Islamist militants were driven out of Konna but that the city, which was captured by the extremists earlier this week, was not yet under government control.

"We are doing sweeps of the city to find any hidden Islamist extremist elements," said Lieutenant Colonel Diarran Kone. "The full recovery of the city is too early to determine as we do not yet control the city, and we remain vigilant."

The raid in Somalia could have been aimed at preventing al-Shabaab fighters from harming the French hostage in reprisal for the Mali operation. However the defence minister, Jean-Yves le Drian, said on Saturday that "the two operations are totally unconnected".

Sanda Abu Mohammed, a spokesman for the Islamist group in Mali called Ansar Dine, said he could not confirm if his fighters were still in Konna. "Since yesterday afternoon I have not had contact with them as the telephone network has been down in this zone."

France said it was acting with the backing of west African states. The former colonial power in Mali and other countries in the Sahel region has hundreds of troops stationed across west and central Africa. "The threat is a terrorist state at the doorstep of France and Europe," Le Drian said.

The west African regional bloc, Ecowas, will begin sending soldiers to Mali on Monday as part of a mission to push Islamist fighters from the country's north, an Ivory Coast government official said on Saturday.

Ecowas has for months lobbied the international community to support its plan for a regional military force to end the nine-month occupation of Mali's north by Ansar Dine, MUJWA, and al-Qaida's north African affiliate, AQIM.