The ISIL terrorist group has acknowledged losing control of Libya's eastern city of Derna to militiamen from the Shura Council of Mujahideen in Derna.
ISIL promised to "avenge" its fighters in a video recording it posted on social media websites on Saturday.
The group released a 10-minute video by the "media office of the province of Barqa" in Libya admitting to the defeat.
In the video, a man in military uniform promises to avenge the ISIL members who died in the fighting.
Derna has seen fierce fighting in recent weeks between the ISIL and the militiamen in Derna.
The Mujahedeen Council of Derna militia group has been fighting the ISIL since June this year.
Its gunmen ousted ISIL from many areas of the city controlled for more than a year by armed groups including the terrorist group Ansar al-Sharia, which is close to the notorious Al-Qaeda terror organization.
A coastal city located near the border with Egypt, Derna has often been described as the bastion of ISIL supporters in the North African country since its fighters first entered the city earlier this year.
The ISIL, which has been engaged in heinous crimes in different parts of Iraq and Syria, emerged in Libya in February, after releasing a video that showed the beheading of 21 Egyptian Christians.
The terrorist group, which launched a military parade in the streets of the coastal city of Sirte in February, has also attacked oil fields to spread out its territory to the east of Sirte.
Libya has two rival governments striving to gain control of the country, with one faction controlling Tripoli, and the other, Libya’s internationally recognized government, governing the northeastern cities of Bayda and Tobruk.
Officials of the Tripoli-based government say the ISIL has allied with the supporters of ousted dictator Muammar Gaddafi to make strategic gains in oil-rich Sirte.