Three French soldiers were killed during a mission to gather intelligence in Libya, President Francois Hollande said Wednesday in the first official confirmation that France has troops in the country where IS controls a key city.
Hollande said the troops died in a helicopter accident while taking part in "dangerous intelligence operations".
He did not say when the incident took place.
Libyan sources gave a different account of events, telling AFP the M17 helicopter was shot down by surface-to-air missiles.
They were "probably targeted by Islamist groups in the Magroun area, about 65 kilometres west of Benghazi" on Sunday, a commander of forces loyal to a controversial general, Khalifa Haftar, said.
Another source close to Haftar -- who opposes the internationally backed unity government in Tripoli as well as the Islamist factions that have overrun large parts of the country -- said the dead soldiers were military advisors.
Announcing their deaths earlier Defence Minister Jean-Yves Le Drian praised the officers' "courage of devotion" but gave no details of how they were killed.
Rival militias in Libya have been vying for power since the overthrow of veteran dictator Moamer Kadhafi in 2011.
Several Islamist groups, including the Islamic State, have a presence around Benghazi which is situated in the east, analysts said.
IS's main stronghold is the central coastal city of Sirte.
Forces loyal to the unity government have been embroiled in a two-month battle to try to retake the city from the jihadists.
- Europe's shores at risk -
Western powers have been nervously watching the group's advance on Europe's doorstep.
Hollande said Libya was experiencing "dangerous instability" and noted: "It's only a few hundred kilometres from Europe's shores."
France had previously revealed its warplanes were carrying out reconnaissance flights over the country from the Charles de Gaulle aircraft carrier.
But Paris has never confirmed reports that it has intelligence agents and/or special forces on the ground.
France, together with Britain, led the push in 2011 for the NATO-led campaign of airstrikes that helped topple Kadhafi's regime.
The two countries were later accused of not doing enough to support Libya after the intervention.
British media reported in May that British special forces had taken part in combat against IS in the country's northeast.
The news of the soldiers' deaths comes as France struggles to recover from a massacre in Nice last week, in which a Tunisian with a fascination for jihad slammed a truck into a crowd, killing 84 people.
IS, which directed last year's attacks on the national stadium in Paris and several nightspots in the capital, claimed the attack.
But French investigators have said there is no proof Mohamed Lahouaiej Bouhlel was acting on the group's behalf.