Despite continued gunfire and explosions near Tripoli on Sunday, Libyan officials and fighters said a bloody local dispute that has strained nerves in the city for three days was being resolved.
Compared to exchanges of rockets and machinegun fire on Saturday, in which medics said at least seven fighters were killed, clashes were limited -- a result, officials said, of a deal among leaders from the capital and rival communities from the town of Zawiyah and clan leaders of the Wershifanna tribe.
We think that we are getting to some kind of stability, Mustafa Abdul Jalil, chairman of the National Transitional Council (NTC) said, blaming irresponsible former rebels for violence which has fanned fears that thousands of fighters who helped topple Muammar Gaddafi may turn on each other.
We are working on this and we hope to achieve something soon, said Abdul Jalil, who NTC members said personally took part in lengthy negotiations since Friday to try to end the clashes between men from Zawiyah and the neighbouring tribe.
There are many accusations from both sides. We don't know how many of the accusations are true, he told a news conference, referring notably to accusations from Zawiyah, strenuously denied by the Wershifanna, that Gaddafi loyalists had attacked NTC fighters around the Imaya military base.
At Imaya, Reuters journalists found the compound, a key component of Tripoli's defences under Gaddafi, occupied by an organised force from the NTC that is the closest Libya has to a national security service until it forms a government that can set about establishing a new army and other defence forces.
NTC troops were also in charge of a bridge over the main road that runs from Tripoli to Zawiyah and west to Tunisia. The bridge has been a bone of contention since Thursday, when rival groups clashed over rights to man checkpoints on the highway.
Mohammed al-Wershifanni, a tribal sheikh of the Wershifanna in the area, told Reuters both sides had agreed to pull back from the bridge and from the military base and to allow in a peacekeeping force sent by the NTC in Tripoli.
Speaking to Reuters nearby, dressed in traditional robes and skullcap, Wershifanni said: We are all brothers ... All the attention on this will only cause trouble.
At the military base, NTC fighter Ibrahim al-Ftasi, dressed in military fatigues and carrying credentials from the NTC's 17th February Brigade, said: There's been an agreement between the Wershifanna and Zawiyah.
He blamed continued firing on a fifth column of Gaddafi loyalists. But NTC troops kept reporters away from the area of the shooting and it was not possible to determine its source.
In a mark of the embarrassment the NTC has felt over the violence, as it seeks to reassure its international backers that it can form a government this month and establish order, an officer in the NTC force at Imaya told journalists he would make trouble if they published photographs of the clashes.
The fighting has caused a surge in comment on social media sites, with critics of the NATO-backed rebellion quick to see it as proof that Gaddafi's enemies were allowing anarchy and supporters of the uprising blaming it on pro-Gaddafi diehards.
In central Tripoli overnight, residents appeared more reluctant than of late to drive around.
Among other signs of tension as the country waits for prime minister-designate Abdurrahim El-Keib to form a government -- within the week, according to Abdul Jalil -- doctors at Tripoli Central Hospital said hundreds of colleagues had stayed away from work since Saturday. They complained of assaults on medical staff by armed men and were demanding NTC protection.
Fighters from Zawiyah, about 50 km (30 miles) west of Tripoli and an early centre of revolt against Gaddafi this year, had alleged that diehard Gaddafi supporters in the tribal lands of the Wershifanna had attacked them late on Thursday.
Representatives of the Wershifanna, a major tribal grouping around the capital, said none of their people backed Gaddafi but were fighting back against encroachment on their lands by the Zawiyah brigades -- a renewal of an old territorial dispute.
By several accounts, trouble flared on Thursday when men from the Wershifanna established a checkpoint on the main highway, challenging the presence there of fighters from Zawiyah. Further clashes ensued, residents said, when both sides tried to secure control of the Imaya military base.
One man from the Wershifanna, speaking to Reuters at Imaya, said: The Zawiyans want the base. The Wershifanna want the base ... They think there is still no government.
(Additional reporting by Francois Murphy and Omar Younis in Tripoli; Writing by Alastair Macdonald; Editing by Janet Lawrence)