MOGADISHU, June 28 (Reuters) - Somalia's government may recognise a former Islamist warlord it had opposed as interim leader of a strategic port city in a bid to defuse tensions, diplomats said, although a new clash between rival militias erupted there on Friday.

The threat of the kind of clan fighting that tore Somalia apart over two decades 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.

Kismayu residents said fresh fighting broke out on Friday between Madobe's Ras Kamboni militia and fighters loyal to Barre Hirale, a warlord also seeking the leadership post and seen as having Mogadishu's backing.

"This is what we feared," said Nadifa Farah, speaking by telephone during clashes that flared through the afternoon, emptying the streets and forcing businesses to shut. It was not immediately clear if there were any casualties.

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 Hirale's troops. An official said nine people died in clashes between the two groups on Wednesday.

Regional capitals and Western donors fear the violence could spread and reverse fragile security gains made in Somalia by African troops fighting against the al Qaeda-linked militants, who are seen as a threat to stability in the region and beyond.

"WILLING TO COMPROMISE"

Government spokesman Abdirahman Omar Osman said Mogadishu wanted a deal but had not decided who would take the post.

"We are willing to compromise, provided that the legality, the constitution and the federal institution and mandate, is protected," he said, adding that 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 environs because al Shabaab Islamist militants still control much of Jubaland's countryside.

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 breakaway 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 and 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. (Additional reporting by Abdi Sheikh; Editing by Edmund Blair and Gareth Jones)

We welcome comments that advance the story through relevant opinion, anecdotes, links and data. If you see a comment that you believe is irrelevant or inappropriate, you can flag it to our editors by using the report abuse links. Views expressed in the comments do not represent those of the Thomson Reuters Foundation. For more information see our Acceptable Use Policy.