French soldiers patrol on July 19 on the Promenade des Anglais in Nice, the scene of the previous week’s truck attack that killed at least 84 people. (Claude Paris/AP)

Three French soldiers were killed in Libya “while on a mission,” the French Defense Ministry announced Wednesday, in the first official confirmation that French special forces have been active in Libya in apparent operations against the Islamic State.

The Defense Ministry declined to confirm the reported details of the soldiers’ deaths, but President François Hollande, addressing a military training center in southwestern France, specifically mentioned a “helicopter crash.”

The Associated Press, quoting Libyan officials, reported that the soldiers were killed Sunday in an attack on their helicopter. An Islamist militia known as the Defending Benghazi Brigade asserted responsibility for the downing.

There are an estimated 2,000 to 5,000 Islamic State fighters across Libya, which has been gripped by unrest and political upheavals since a Western-aided uprising in 2011 deposed longtime ruler Moammar Gaddafi, who was captured and killed by rebels.

In Paris, government spokesman Stéphane Le Foll said in a radio interview that French forces in Libya were there to “ensure that France is present everywhere in the fight against terrorism.”

The French newspaper Le Monde first reported the presence of the special forces, claiming in February that several thousand French troops were engaged in “clandestine operations” against the Islamic State. It also reported that a November airstrike that killed Abu Nabil al-Anbari, believed to be the top Islamic State figure in Libya, was “initiated by Paris.”

Anbari was thought to be the narrator in a February 2015 video that showed the beheadings of 21 Christian workers in Libya, nearly all Copts from Egypt.

At the time, Libyan officials denied the Le Monde report and the French government said its interest was merely in reconnaissance.

Libyan-based militants have not been directly linked to any of the major Islamic State attacks in Europe, including the rampage across Paris last year that claimed 130 lives and last week’s Bastille Day truck attack in Nice, which left 84 dead. Some suspects had links to Tunisia and other nations in northern Africa.

Since 2014, Libya has been split between rival governments backed by various militias and tribes. A unity government brokered by the United Nations in December has struggled to make headway.

According to the claim of responsibility by the Defending Benghazi Brigade militia, the helicopter used by the French forces belonged to Khalifa Hifter, a Libyan general who opposes the internationally recognized government, the AP reported.

The United States has conducted occasional airstrikes in Libya amid deepening worries among Western powers and allies about the expanding footholds in the country of the Islamic State and other militant groups, including factions inspired by al-Qaeda.

In addition, about two dozen U.S. Special Operations troops have been stationed at two outposts in eastern and western Libya since late 2015, seeking to coordinate with Western-allied militia groups.

In February, U.S. F-15 fighter jets struck a suspected Islamic State camp on the outskirts of Sabratha in western Libya, killing at least 40 people in an early-morning attack that targeted senior militant Noureddine Chouchane. The Pentagon said Chouchane was suspected of overseeing attacks on Western tourists in neighboring Tunisia in 2015.

The Sabratha raid marked the second U.S. attack against Islamic State militants in Libya.

On Tuesday, U.N. Secretary General Ban Ki-moon said there was a “distinct possibility” that the Islamic State could be driven from its main Libyan stronghold in the coastal city of Sirte but could scatter to other parts of the region.

Ban cited a recent U.N. report that said there are about 2,000 to 7,000 Islamic State militants in the area from Egypt to Mali and Mauritania.

Brian Murphy in Washington contributed to this report.