Gunmen attacked Libya's interior ministry building in the capital Tripoli late Tuesday, forcing its closure, witnesses said.
In a separate incident in the eastern city of Benghazi overnight an explosion injured two members of the special forces.
Gunfire could be heard around 10.00pm (2000 GMT) in the vicinity of the building but it was not clear if it was from the attackers or warning shots from guards inside.
Later in the evening, armed men surrounding the ministry building with sandbags and blocked its entrance with sand, before leaving the area, a security official said.
The official blamed militants from the western city of Zintan of having carried out the attack.
Last Wednesday gunmen from Zintan tried to free five comrades seized by former rebel fighters, a security source told AFP at the time.
At the time the two sides fought it out using small arms and heavy weapons near the centre of Tripoli.
Rebels from Zintan first entered Tripoli in August 2011, when they helped to drive forces loyal to former dictator Moamer Kadhafi out of the capital.
Since then, some of them have stayed in the capital, occupying former military bases and other state institutions.
In a separate incident overnight Tuesday to Wednesday a car blew up near a special forces patrol in the flashpoint eastern city of Benghazi, wounding two soldiers, a security source said.
Last week in the city, an army officer was killed by a bomb placed in his official vehicle.
Libya's authorities, who are struggling to form a professional army and police, regularly use former rebels to secure the borders or to intervene in tribal conflicts.
The government has failed to disarm and disband the former rebel groups who implement the law in parts of the country.
Gunmen attack Libya's interior ministry in Tripoli forcing its closure