One of two French intelligence agents kidnapped by insurgents in Somalia last month escaped on Wednesday after killing three of his captors and fled to the presidential palace in Mogadishu, officials said.
Gunmen had seized the Frenchmen at a hotel in the capital on July 14 then handed one to the Hizbul Islam rebels and the other to fighters from the al-Shabaab group, which Washington describes as al-Qaeda's proxy in the Horn of Africa state.
There were conflicting reports from the Somali capital. Some government officials suggested that the Frenchman had escaped from his captors, whereas an Islamist figure and another official said a ransom had been paid.
One associate of the kidnappers said the Frenchman had been freed after talks with Somali elders.
Somali government officials at the city's hilltop Villa Somalia palace said the man who escaped was in good health.
"We understand he killed three al-Shabaab guys who were guarding him. I cannot understand how this good story happened but now he is in the hands of the government," Abdiqadir Odweyne, a senior police commander, told Reuters.
An al-Shabaab source confirmed three of its members had been killed, but said it was not known by whom: "Three of my friends died but who killed them is the question. We were expecting a ransom this morning," the rebel source said.
But the French foreign ministry denied reports of a violent escape.
"His release took place without violence, contrary to certain suggestions made locally," the ministry said, in a brief statement that gave no details on the circumstances of how the hostage came to be liberated.
Somalia's fragile U.N.-backed government faces a stubborn insurgency that includes foreign jihadists and militants who Western security agencies say are using the country as a safe haven to plot attacks in the region and beyond.
A Somali government official and some media said last month that the two Frenchmen had been posing as journalists. Paris has denied that, saying they were on official government business.
Mogadishu is one of the world's most dangerous cities and has a history of kidnappings of foreigners, mainly aid workers and journalists. Hostages have normally been released for substantial ransom payments after days or weeks in captivity.
Earlier this month, Somali gunmen freed six foreigners -- two Kenyans, two French, a Bulgarian and a Belgian -- abducted in November.
President Sheikh Sharif Ahmed's administration controls only small parts of the lawless country's central region and a few districts of bomb-blasted Mogadishu.
Violence has killed more than 18,000 Somalis since the start of 2007 and driven another 1.4 million from their homes.
That has triggered one of the world's worst humanitarian emergencies, with the number of people needing support leaping 17.5 percent in a year to 3.76 million or half the population.
Three-quarters of those in the most need are concentrated in central and southern regions where the fighting is heaviest and aid workers have the least access.
Ahmed has called on the insurgents to observe a ceasefire during the Muslim holy month of Ramadan, which started last week. But the rebels have rejected that and accused the president of planning to use any truce to re-arm his forces.