Three French soldiers have been killed in Libya, officials have said, also confirming for the first time that members of France's special forces are engaged in operations in the North African country.

French President Francois Hollande said on Wednesday the three soldiers had been killed in a helicopter crash during an intelligence-gathering operation.

"At this moment we are carrying out dangerous intelligence operations [in Libya]," Hollande said in a speech.

France's Defence Minister Jean-Yves Le Drian said in a statement that he regretted "the loss of three French officers who died while on mission in Libya" - but gave no further information as to where or how the troops were killed.

Earlier on Wednesday, government spokesman Stephane Le Foll provided the first official confirmation that members of the French special forces were operating in Libya, which has been in turmoil since 2011 following the uprising that led to the removal and killing of Muammar Gaddafi.

"Special forces are there, of course, to help and to make sure France is present everywhere in the struggle against terrorists," Le Foll said.

French special forces, in conjunction with Britain and the US, have been advising forces loyal to eastern Libyan commander Khalifa Haftar, which have been battling opponents in Benghazi for more than two years, the Reuters news agency reported.

Libyan military officials would not comment on a report that the French nationals were in a helicopter that crashed near Benghazi on Sunday. Officials said at the time that four people had died in the crash, all of them Libyan.

A group called the Benghazi Defence Brigades claimed to have shot down the aircraft.

France and Britain led the push in 2011 for the NATO-led air campaign that helped topple Gaddafi's regime. Both countries were later accused of not doing enough to support Libya after its military intervention.

Libya has been split between rival governments and parliaments based in the western and eastern regions, each backed by different militias and tribes.

Western powers have been backing Libya's UN-brokered government, hoping, among other things, that it will seek foreign support to confront fighters from the Islamic State of Iraq and the Levant (ISIL, also known as ISIS).

ISIL on the retreat

Meanwhile, UN Secretary-General Ban Ki-moon said in a new report released on Wednesday that ISIL fighters in Libya were facing the "distinct possibility" of defeat in their last stronghold in Sirte.

ISIL took advantage of Libya's political turmoil to establish a presence in several of the country's towns and cities from 2014. However, the group struggled to maintain territory and has one remaining stronghold in the city of Sirte - its most significant base outside Iraq and Syria.

Ban said in the report to the UN Security Council that estimates of ISIL fighters in Sirte - hailing from Libya, Tunisia, Algeria, Egypt, Mali, Morocco and Mauritania - range in number from 2,000 to 7,000.

However, a recent offensive against ISIL by forces aligned with the UN-backed government meant the "the current number of those in Sirte is now likely well under 1,000", Ban said.

The UN chief expressed concern at the likelihood that ISIL fighters relocating from Sirte would regroup "in smaller and geographically dispersed cells throughout Libya and in neighbouring countries" with the intention to conduct attacks.