Clashes between Libyan elite forces and gunmen killed six soldiers in Benghazi on Saturday, the army said, in the latest bout of unrest as the government struggles to control rebels from the 2011 uprising.
The interim leader of Libya's army warned of the danger of a "bloodbath" as the unrest in Benghazi flared again a week after violence killed more than 30 people in the eastern city.
Explosions and heavy gunfire could be heard at about 4:00 am (0200 GMT) near the special forces headquarters and in Al-Lithi district, not far from the city centre, an AFP journalist and witnesses reported.
The special forces said on Facebook that its members exchanged light arms and rocket fire with an "outlaw" group, and that three of its members were killed and two wounded.
Separately, a security forces spokesman in Benghazi, Colonel Mohammed Hijazi, said six special forces soldiers had been killed and five wounded.
He said the last two fatalities had been ambushed and "had their throats cut".
Hijazi blamed the attacks on "unknown groups of masked men", but said there was a "cautious calm" in Benghazi on Saturday afternoon.
The special forces spoke of a "takfir group", an allusion to Islamist extremists.
The government said that it would hold "an emergency meeting" to discuss the situation.
Benghazi, the cradle of the uprising that ousted Moamer Kadhafi's regime in 2011, has been increasingly rattled by clashes between regular troops and militias made up of former rebels who fought the late dictator's forces.
Militias with different tribal and ideological links now control parts of Benghazi, where there have been attacks on army and police officers and facilities.
Islamists have often been blamed for attacks in Benghazi, but some observers say militias have launched attacks to stop security forces from regaining control of the city.
The latest clashes came hours after dozens of protesters forced a brigade of former rebel fighters from their base in Benghazi on Friday evening.
The protesters burned two vehicles belonging to the First Infantry Brigade, before moving on the barracks, an army officer said.
A witness on site said the protesters, some of whom were armed, had fired in the air and fired a rocket-propelled grenade at a wall of the barracks, though nobody was hurt.
The brigade was set up by former rebel fighters and says it takes its orders from the defence ministry.
The group later attacked a police station, the offices of border guards and facilities and another office building of the First Infantry Brigade, witnesses said.
Following that first attack, Salem al-Konidi, the interim head of the army warned "there will be a bloodbath" if the special forces are targeted.
"There could be a catastrophe in Benghazi. If they have demands, they can wait until (Saturday). We can discuss with them."
He said he did not know who had launched the attack or what their motive was, but appealed to elders and dignitaries to act to try to head off the unrest.
Konidi is the interim replacement for General Yusef al-Mangoush, who resigned on Sunday, a day after fighting in Benghazi killed 31 people and left dozens more wounded.
He had come under mounting criticism for failing to form a national army in the face of resistance from militias unwilling to surrender their independence.
In last week's violence, armed demonstrators opposed to the city's militias attacked the pro-Islamist "Shield of Libya" brigade at its barracks.
The Shield of Libya is mostly made up of rebels who battled Kadhafi and is also under defence ministry control.
The demonstrators confirmed that they had wanted to dislodge the armed "militias" from Benghazi, but denied that they had any part in the violence in the city on Friday and Saturday.
They accused the "Shield of Libya" and Islamist groups of mobilising their members to avenge their "defeat" last week by attacking regular troops.
The 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.