Somalia's government is expected to recognize a former Islamist warlord it had opposed as interim leader of a strategic port city, diplomats said, defusing a crisis over rival claims to the post that had raised fears of a return to clan warfare.
The threat of the kind of clan fighting that over two decades tore Somalia apart has hung over Kismayu since Ahmed Madobe, leader of the Ras Kamboni militia, was chosen by a regional assembly to lead Jubaland and its port in May.
The fate of Kismayu and the surrounding region in southern Somalia has been seen as a litmus test of whether the government can manage a federal state and cement a fragile peace in place since African peacekeeping troops drove out Islamist militants.
Western and regional diplomats, all with a close knowledge of Somalia and the workings of its government, told Reuters that Mogadishu had changed tack and was resigned to having the Ras Kamboni leader stay in charge, but on an interim basis.
"They recognise that they have to deal with Madobe," said one senior Western diplomat.
Regional capitals and Western donors are nervous about any reversal of delicate security gains made in Somalia by African troops fighting against the al Qaeda-linked militants, seen as a threat to stability in the region and beyond.
Central government spokesman Abdirahman Omar Osman said Mogadishu, which had widely been seen to back another candidate, was ready for a deal but it had not decided on who it would be.
"We are willing to compromise provided that the legality, the constitution, and the federal institution and mandate is protected," he said, adding senior government officials were in Kismayu for negotiations with the rival parties.
Even with the regional leader title, Madobe will only really control Kismayu and its immediate surrounds because al Shabaab Islamist militants still control much of Jubaland's countryside.
Dozens of people have been killed in Kismayu since May in sporadic clashes between Madobe's Ras Kamboni militia, opposed by the central government, and fighters loyal to Barre Hirale, another former warlord seen as having Mogadishu's backing.
Rival clans want control of port taxes, valuable charcoal exports and levies on arms and other illegal imports.
If a deal is struck, one government source said the interim administration would be in place for up to a year before a vote.
The situation has been complicated because of ambiguity over how Somalia, including its break-away regions, will be governed as a federation and because Mogadishu has little leverage as its poorly paid and trained security forces cannot impose control.
"Acknowledging that Madobe is the de facto leader in charge of an interim Jubaland administration would be pragmatic," said Matt Bryden, a director of Sahan Research think-tank who previously coordinated a U.N. monitoring report on Somalia.
"The government can't afford to become embroiled in this," he said. "It doesn't have the time, the resources or sufficient influence in Jubaland."
Madobe was a governor of Kismayu during an administration that was routed by Ethiopian forces sent into Somalia between 2006-2009 with tacit U.S. backing.
The European Union's top Africa official, Nicholas Westcott, said it was vital for a deal to improve security in Jubaland, a region which some analysts fear could otherwise break away.
"If Somalia is fragmented it will never be in position to develop or resolve all the conflicts," Westcott said.