Islamic State militants briefly entered the centre of the western Libyan city of Sabratha, beheading 11 members of local security forces and killing another six in overnight clashes before retreating, local authorities say.
Islamist militants have taken advantage of political chaos and a lack of central authority to establish a presence in Libya, with fighters loyal to IS seizing control in Sirte and staging attacks in several other cities.
The fighting in Sabratha started when local brigades - formerly among the many rebel groups that joined in an uprising that overthrew Muammar Gaddafi in 2011 - attacked suspected IS hideouts 15km south of the city, Sabratha's municipal council said in a statement on Wednesday.
It said the militants then "took advantage of the security vacuum downtown and spread out all over the city".
Sabratha's mayor, Hussein al-Thwadi, told Reuters that six members of the local brigades had been killed in clashes on Tuesday evening and 11 more were beheaded when militants entered the security directorate building in the city centre overnight before the brigades forced them out.
Late on Wednesday the Deterrence force, an armed brigade based in Tripoli that has a counter-terrorism role, said it had arrested three senior Libyan IS members in a suburb of the capital, including Sabratha commander Mohamed Saad Altajouri.
A security source from the western city of Zintan said on Wednesday that authorities had agreed to treat the five wounded brigade members from Sabratha, a sign that Zintan and Sabratha may be prepared to co-operate in the fight against IS.
The two cities have been on opposite sides of Libya's post-Gaddafi conflict, with Zintan allied to the internationally recognised government now based in the country's far east and Sabrathan forces among those that support a rival government whose armed supporters seized the capital Tripoli in 2014.