Three French soldiers have died in Libya after their helicopter was shot down, President Francois Hollande says.
The soldiers were killed while carrying out "dangerous intelligence operations", Mr Hollande said.
Libya's UN-backed government responded by saying that their presence was a "violation" of the nation's sovereignty.
It said in a statement that it was "displeased with the French government's announcement".
Earlier on Wednesday, French defence ministry spokesman Stephane Le Foll confirmed for the first time that its special forces were in Libya.
On Tuesday, Associated Press quoted Libyan officials as saying an Islamist militia shot down a French helicopter.
The attack on Sunday happened near the city of Benghazi, and left no survivors, AP reported.
Libya has fragmented since the 2011 uprising when Col Muammar Gaddafi was ousted from office with the help of Nato air strikes.
It now has rival administrations, backed by various militias and brigades spawned by the revolution - and the chaos has allowed fighters from so-called Islamic State (IS) to gain a foothold.
Mr Le Foll, in an interview with France Info radio on Wednesday, said French special forces were in Libya to "ensure that France is present everywhere in the fight against terrorism".
While France had previously said its warplanes were carrying out reconnaissance flights over Libya, this is the first formal confirmation that France has special forces inside the country.
Their presence was first reported by Le Monde newspaper in February (in French) but later denied by Libyan officials.
Le Monde also said that French intelligence officials were stationed inside Libya to help the fight against IS.
Analysis: Rana Jawad, BBC North Africa correspondent
Benghazi, the birthplace of the 2011 revolution, has been at war for two years. During this time Gen Khalifa Haftar, head of the armed forces backed by Libya's eastern administration, has sought to oust a mix of mainly Islamist militias, including those with IS affiliations, from the city.
In recent months, his fighters have made significant gains, which analysts suspect are largely thanks to logistical support from the French special forces operating there.
Some members of the various militias they are fighting have recently regrouped, now calling themselves the Benghazi Defence Brigades (BDB). A social media news account affiliated to the BDB has reported that the group was responsible for shooting down the French helicopter. Whatever their affiliations, they show the conflict is a long way from being resolved.
Foreign special forces from a number of countries have been operating in or over Libya for quite some time now, but the nature and extent of these operations have largely been secret. The deaths of the French soldiers is likely to trigger hard questions for Western nations getting entangled in a war with multiple and complex dimensions.
While the fighting continues on the ground in parts of the country, political deadlock continues despite a UN-brokered deal in December to form a unity government.
This is now based in the capital, Tripoli, but with little real power in the city or over the whole country as rival administrations operate in both the east and west.
The oil-rich country once had one of the highest standards of living in Africa with free healthcare and free education, but five years on from the uprising it is facing a financial crisis.
At the same time militias, which hold considerable power across Libya, are split along regional, ethnic and local lines, creating a combustible mix.
But in a new report to be presented to the UN Security Council, Secretary-General Ban Ki-moon said IS was facing the "distinct possibility" of defeat in its last Libyan stronghold of Sirte.