Five people were killed and at least 10 wounded when militiamen tried to storm Libyan government security headquarters in Benghazi, army officials said, triggering a firefight that lasted more than a hour, Reuters reported.
The officials said the attackers were probably members of an Islamist militia.
Libya's central government is struggling to control armed groups, militias and brigades of former rebels who helped oust Muammar Gaddafi in 2011 and now refuse to disarm.
Special forces in Libya's second-largest city, a port that dominates the country's volatile eastern region, have often clashed with the Islamist group Ansar al-Sharia - listed as a terrorist organization by Washington.
Car bombings and assassinations of soldiers and police have become common in Benghazi, where a suicide bomber detonated an explosives-packed minibus outside a special forces camp on Tuesday, killing two people and wounding two more.
Most countries have closed their consulates in the city and some foreign airlines have stopped flying there since the U.S. ambassador and three other Americans were killed in an Islamist militant attack in September 2012.