Media playback is unsupported on your device Media caption Militiamen are seen on Zawiya Street in Tripoli after the gunfight erupted

Four people have been killed and at least five injured in a firefight which erupted earlier in the centre of the Libyan capital, Tripoli.

The clash centred on an old intelligence building bombed by Nato in last year's uprising against ex-leader Muammar Gaddafi.

A brigade from the city of Misrata tried to free prisoners held inside, leading to a confrontation with another armed group from Tripoli.

The casualties were from both brigades.

The gunfight broke out near the building between Zawiya and Saidi streets.

The roads quickly reopened once the situation had calmed.

"I regret the incident. I don't want to go into details, but it was the result of a problem between Misrata thwars [revolutionaries] and members of the military council of Zawiya street," Abdul Hakim Belhaj, the head of the Tripoli military council, told a news conference.

"What happened is an irresponsible act and the situation is now under control. Since the afternoon, we have not heard any gunshots," he added.

It is yet another sign of the continuing security threat posed by the disparate militias comprising former rebels, says the BBC's Mark Lowen in Tripoli.

They still wield significant power in the absence of a national army or police.

But Libya's new government, under popular pressure, has now begun the process of disbanding the groups and integrating them within the defence and interior ministries, our correspondent says.

Tens of thousands of fighters still make up the various brigades, and sporadic clashes have broken out between them in recent weeks.

The transition from civil war to a secure, stable Libya remains slow and difficult and dealing with the militia problem is one of the key challenges ahead, our correspondent adds.