Libya on Tuesday named Yousef al-Manqoush, a retired general from the anti-Gaddafi bastion of Misrata, as head of the armed forces in the first significant move to build a new Libyan military.
The appointment was announced as four fighters were killed in a gun battle between rival militias in Tripoli, underlining the interim government's difficulties in controlling the increasingly fractious groups who toppled Muammar Gaddafi.
More than two months after he was captured and killed, real power remains in the hands of the militias, who have carved up Libya and its capital into competing fiefdoms, each holding out for the share of power they say they are owed.
To help reinstate law and order, the interim government plans to integrate thousands of former rebels in the military, the police and other civilian jobs. Some militia chiefs say they will only cede command of their fighters once an organised military and security apparatus is in place.
Manqoush's appointment by National Transitional Council chairman Mustafa Abdel Jalil could pave the way toward forming a structured military. But it is not clear yet whether militia commanders will accept him.
His prospects could be boosted by the fact that he hails from Misrata, besieged for months by Gaddafi's forces and home to a number of the militias that helped to topple him and now seek what they see as a fair share of power. Rebels from Misrata in particular hold a vast arsenal of tanks, rockets and guns.
The new interim defence minister, Osama Al-Juwali, comes from Zintan, base of a another major militia.
Manqoush is a retired army general who joined the insurgency against Gaddafi and now serves as the deputy defence minister, said an NTC official who asked not to be named.
He's a military officer who chose to retire. He joined the front lines early in the revolution, was arrested by Gaddafi forces and then was freed by the revolutionaries.
DEADLINE TO LEAVE
Militias were given a December 20 deadline to leave the capital and have dismantled most of their checkpoints and limited their presence on Tripoli's streets, but crucially kept some bases.
Tuesday's battle on Tripoli's Zawiya road was the first involving militias since December 11, when soldiers from the new national army failed to wrest control of Tripoli's international airport from a militia force from Zintan.
Former rebels from Tripoli controlling a security compound in the capital fought off dozens of fighters from Misrata who were trying to seize a group of prisoners in a gun battle that lasted more than an hour, medics and former rebels said.
Some of them screamed 'We're from Misrata, you dogs!' while they were firing, said another Tripoli fighter. They wanted to take them (the prisoners) by force, they used 106mm (rocket) launchers and 14mm machine guns.
Afterwards armed men combed central Tripoli looking for Misratan fighters. A Reuters witness saw them capture one man, and kick and punch him as he was marched into the compound.
A pickup truck daubed with the words 'The Defence Brigade, Misrata Revolutionaries' lay across the highway, riddled with bullets and with blood stains on the back seat. One fighter said 11 militiamen from Misrata had been captured.
Vehicles carrying dozens of fighters and heavy calibre machine guns blocked roads leading to the compound and snipers were stationed on rooftops.
The situation is under control, said Abdel Hakim Belhadj, an Islamist whose Tripoli Military Council says it has a mandate from Libya's new rulers to secure the capital.
The people who caused the problem were arrested and will face justice, he told reporters.
A few hundred metres down the road at Tripoli's central hospital, dozens of militants filled the corridor leading to the emergency room. A few elderly women, relatives of the dead and injured, sobbed as they hurried towards the hospital.
(Editing by Kevin Liffey and Jon Boyle)