Jihadist gunmen stormed police headquarters in Libya's second city Benghazi before dawn Friday, sparking fighting that killed at least nine soldiers and police, government and medical sources said.
"Armed brigades of Ansar al-Sharia and other criminal groups attacked the complex with both light and heavy weaponry," a government statement said.
The jihadist group Ansar al-Sharia was placed on the US terror list in January.
It said nine special forces members were killed and that other soldiers and policemen were wounded.
Some attackers were killed or arrested, the statement said without elaborating.
Special forces intervened to try to evict the gunmen, triggering fighting elsewhere in the eastern city that also wounded 24 members of the security forces, the medical sources said.
An army officer, speaking on condition of anonymity, told AFP that four soldiers were missing.
The officer said gunmen attacked the headquarters early on Friday. Blasts and gunfire rocked the Mediterranean city for two hours from 0100 GMT, witnesses said.
The officer told AFP that four of the soldiers killed died as they were heading back to barracks after the fighting had subsided.
He said "tension" was running high among army units in Benghazi.
Another security source said earlier the gunmen had been trying to seize a vehicle packed with weapons and ammunition that the police had taken from them.
Friday's violence comes just days after a car bomb targeted a special forces barracks in Benghazi, killing two soldiers and wounding three.
Signup to our newsletter and follow us on Facebook and Twitter!
- Benghazi plagued by violence -
Benghazi was the cradle of the 2011 uprising that ended Moamer Kadhafi's four-decade rule and has since been plagued by violence that has killed dozens of members of the security forces, judges and foreigners.
The government has been struggling to consolidate control in the vast and mostly desert country, which is effectively ruled by a patchwork of local militias and awash with heavy weapons looted from Kadhafi's arsenals.
The lawlessness has also extended to the capital.
On Tuesday, gunmen stormed the parliament building in Tripoli, forcing lawmakers to postpone a vote for a new prime minister to replace Abdullah al-Thani.
He quit in April after just five days in the job, saying he and his family had come under attack.
Thani had been selected to replace Ali Zeidan, who was ousted by parliament in March for failing to prevent a rebel oil shipment and end the lawlessness in Libya.
Foreign missions have also been hit, including the US consulate in Benghazi, which was stormed by jihadists in September 2012, resulting in the deaths of the ambassador and three other Americans.
As well as Al-Qaeda-inspired violence, Tripoli authorities have had to contend with a revolt in the east by former rebel militiamen demanding the restoration of the autonomy the region enjoyed for the first 12 years after Libyan independence in 1951.
The militia seized four key oil terminals last July, launching a blockade that slashed Libyan exports from 1.5 million barrels per day to just 250,000 bpd.
The government struck a deal early last month to end the stand-off which has cost it more than $14 billion (10.1 billion euros) in lost revenues and was instrumental in Zeidan's fall.
The army has retaken control of two of the four terminals and the OPEC oil cartel has said it expects exports to recover to 1.0 million bpd by-mid June.
But negotiations are still continuing for the return of the other two.