Deadly clashes have broken out in Libya's eastern city of Derna between local Islamist militias and militants affiliated to Islamic State (IS).
The fighting broke out on Tuesday night after Nasser al-Aker, a senior Islamist militant from Derna's Abu-slim Martyr's Brigade, was killed by members of IS.
IS established a base in Derna in October and the group has tightened its grip on the city in recent months.
Residents say that control of the city is split between two militant groups.
About 20 fighters were reported to have been killed in the clashes between IS and the al-Qaeda-linked Mujahadeen Shura Council of Derna, an umbrella group for local Islamist militias.
Salem Derbi, the commander of the so-called Abu Salem Brigade, was believed to be among those killed by IS.
The Shura Council released a statement following the death of Al-Aker declaring "holy war" on IS "until none of them are left".
The 55-year-old, who fought in Afghanistan and was once held in the UK on terrorism charges, was killed along with his aide.
Derna - a jihadist stronghold in the 1980s and 1990s during the insurgency against Muammar Gaddafi - has descended into chaos as Libya grapples with a power vacuum left by the overthrow of Gaddafi in 2013.
One witness told the BBC that residents were scared to go outside, leaving most shops and bakeries closed.
Analysis: Rana Jawad, North Africa correspondent
Libya's vast number of rival militias have long been running the show. They've spun a web of localised conflicts on a city and regional level in recent years that has allowed IS's local sympathisers and foreign fighters to establish a foothold in two major cities: Derna in the east and Sirte in the West.
The political chaos engulfing the state also helped them flourish, but it is the very local nature of Libya's conflict - its small population and family ties - that may yet prove detrimental to IS's survival in Libya in the long term.
In the past month we've seen rival armed groups increasingly preoccupied by fighting against IS militants than against each other.
IS has expanded its hold on Libyan territory in recent months to include the whole of the central city of Sirte and Harwa to the east of the country.
Its capture of Sirte gives the group access to the road to the country's third largest city of Misrata, in the west.
The rapid rise of the group in Libya has alarmed Western powers, which fear it gaining a stronghold on the Mediterranean across from mainland Europe.
Libya's internationally recognised parliament is operating in exile in the eastern port of Tobruk after being forced from the capital, Tripoli. A rival parliament, the Islamist-dominated General National Congress, is nearly 1,000km (620 miles) to the west in Tripoli.
In an attempt to stabilise the country, the UN presented both factions with a draft proposal for a unity government on Tuesday.
The plan unveiled at talks in Morocco addresses terms of a truce and disarmament of armed groups.