Derna campaign (2014–16)

In October 2014, the self-declared Islamic State of Iraq and the Levant (ISIL) took control of numerous government buildings, security vehicles and local landmarks in the Eastern Libyan coastal city of Derna. Although some media outlets reported the control as being absolute, rival groups like the al-Qaeda-affiliated Abu Salim Martyrs Brigade continued to control parts of the city. Clashes erupted between ISIL and an alliance of Islamist groups in June 2015, with ISIL retreating from Derna to outlying suburbs the following month. However, clashes continued between the Islamist alliance and the Tobruk-based government forces.

Background
The city of Derna has been considered the most pious Muslim city in Libya and has a long history of Islamist radicalism. In 2007, American troops in Iraq uncovered a list of foreign fighters for the Iraqi insurgency and of the 112 Libyans on the list, 52 had come from Derna. Derna contributed more foreign fighters per capita to al-Qaeda in Iraq than any other city in the Middle East and the city has also been a major source of fighters in the Syrian Civil War and escalation of the Iraqi insurgency, with 800 fighters from Derna joining ISIL.

ISIL takeover of Derna
On 5 October 2014, the ISIL-linked militant factions came together and pledged allegiance to ISIL. After the pledging ceremony, more than 60 pickup trucks filled with fighters cruised through the city in a victory parade. A second more formal gathering took place on 30 October, where militants gathered to pledge allegiance to Abu Bakr al-Baghdadi in the city square, where a handmade bomb was detonated.

Libyan airstrikes and planned assault
On 12 November 2014, Libyan Air Force fighter jets carried out airstrikes in Derna, possibly in retaliation for the car bombs, which exploded in Benghazi, Tobruk and the Labraq Airport. Six ISIL militants were killed and 20 militants were wounded. According to Human Rights Watch, some residents have fled the city in advance of an announced Libyan Armed Forces assault on Derna. Approval for a Libyan Army ground assault on Derna was given on 6 December 2014 and army units moved within a few kilometers of Derna, retaking control of villages and roads leading to the city. From December 2014, US drones and electronic surveillance planes began making "constant flights" from Italian bases over Derna. On 25 March 2015, the Tobruk-based government announced it was launching an offensive on the city of Derna, to expel ISIL and other militant groups from the city.

Egyptian military airstrikes
On 15 February 2015, the Islamic State in Libya released a video depicting the beheading of 21 Coptic Christians from Egypt. Within hours, the Egyptian Air Force responded with airstrikes against IS training locations and weapons stockpiles, killing 50 militants in Derna. Warplanes acting under orders from the "official" Libyan government also struck targets in Derna, reportedly in coordination with Egypt's airstrikes. A Libyan official stated that more joint airstrikes would follow.

2015–2016 Battle of Derna
In March 2015, the Libyan National Army, affiliated with the Tobruk-based government, began to implement a siege of the city of Derna, in preparation for a future offensive on the city. However, by May 2015, the operation had stalled due to disputes between commanders and affiliated tribes.

The Shura Council of Mujahideen in Derna, an umbrella organisation of Derna-based Islamist factions opposed to ISIL, launched an offensive against ISIL in June 2015, following its involvement in the killing of two of their leaders. After days of clashes, they were able to push ISIL out of large portions of the city., but clashes continued between them and the Tobruk-based government forces. By July 2015, the last ISIL militants in Derna were expelled from the city, withdrawing to al-Fatayeh on the outskirt where they continued to clash with the Derna Shura Council. Taking advantage of ISIL's collapse in the city, the Shura Council began to impose their own rule and Libyan Army forces attempted to advance on the city. Following continued clashes, ISIL retreated from al-Fatayeh and positions in Derna's outskirts in April 2016, reportedly to the group's stronghold in Sirte.

U.S. airstrike
The United States launched an airstrike at Derna on 13 November 2015, targeting senior ISIL leader Abu Nabil al-Anbari. Abu Nabil had previously led Al-Qaeda in Iraq operations between Fallujah and Ramadi from 2004 to 2010 before relocating to Libya. It was the first military action against ISIL by the United States outside of Syria and Iraq. The Libya Herald reported that Abu Nabil al-Anbari was not killed in the airstrike, however a eulogy to Abu Nabil al-Anbari was published online by a member of ISIL some weeks later and an interview with his replacement was published in an ISIL magazine in March 2016.