The clashes broke out when an armed group opposed to the U.N.-backed Government of National Accord (GNA) in Tripoli tried to approach the capital and were confronted by forces that have aligned themselves with the GNA, the witness said.
The fighting exposes the GNA's vulnerability to militias that gained influence during and after Libya's 2011 uprising.
The anti-GNA forces, which are aligned with a previous, self-declared government, were driven from Tripoli late in May and have been trying to regroup. The GNA recently issued a warning about a counter-attack on the capital.
Since the GNA arrived in Tripoli last year it has co-opted some of the many armed groups that had a presence in the capital. But it has made little progress integrating them and the security situation has remained highly volatile.