MPs were evacuated from the building in southern Tripoli as heavy gunfire erupted after a convoy of armoured vehicles entered the city from the airport road and headed for the General National Congress (GNC).
Residents said gunmen in civilian clothes attacked the building.
GNC speaker Nuri Abu Sahmein speculated the attack, in which no casualties were reported, could have been the work of the rogue general, Khalifa Haftar.
But some witnesses said the gunmen were members of the powerful Zintan brigades, made up of former rebels who fought late dictator Moamer Kadhafi in Libya's 2011 revolution.     

The groups from Zintan now control areas in southern Tripoli around the airport, and they are known for their opposition to Islamists.
An AFP photographer said a column of smoke billowed over the GNC building after gunmen set fire to an annex, and that several cars parked nearby had been damaged.
Later, the gunmen were seen withdrawing to their bases and gunfire was heard along the airport road, residents said.
Militias have launched several attacks on the GNC, including on March 2 when two lawmakers were shot and wounded.
The latest violence in Tripoli came after deadly fighting in the eastern city of Benghazi, where Haftar unleashed his so-called National Army on Islamist militiamen on Friday, backed by warplanes.
It was not immediately clear if there was any link between the unrest in Tripoli and the clashes in Benghazi, where at least 79 people were reported killed.
The Zintan brigades ordered the GNC to evacuate in February, setting a deadline, but did not act against parliament when the ultimatum expired.
In Benghazi, the retired general accused by Tripoli of staging a coup has said he is readying a new assault on Islamist groups, vowing to eradicate "terrorism".
"Each battle is followed by a regrouping of units. And we will return in force," Haftar said after his men withdrew late Friday.
The government accused the "outlaw" Haftar of trying to mount a coup and declared a Benghazi no-fly zone.


Latest News from Sports News Desk