Libya's UN-backed government has reacted strongly following France's confirmation that its special forces have been operating in the country, which also sparked angry protests in the capital Tripoli against French military intervention.

The French government announced on Wednesday that three of its soldiers had been killed in a helicopter crash in eastern Libya during an intelligence-gathering operation - the first time Paris acknowledged its presence in the oil-rich country.

In a strongly worded statement late on Wednesday, the Tripoli-based Government of National Accord (GNA) said that it had asked France to explain the presence of its forces in the country.

"The Presidential Council expresses its deep discontent at the French presence in eastern Libya without coordination with the Council, which was declared by the government of France."

There could be "no compromise" over Libyan sovereignty, the council added.

At the centre of the controversy is General Khalifa Haftar, an opponent of the UN-backed government who leads a large army fighting armed groups in eastern Libya.

If it is proved that the French government is backing him, then tensions could escalate amid increasing questions about the western role in Libya.

"This [France's action] will destabilise the country. This is a sort of coup against the political process and against the democratic path chosen by the Libyan people," Mansour Al Hasadi, a member of the GNA, told Al Jazeera.

"It is also against the political agreement sponsored by the UN, the international community and the Security Council."

'Combat role?'

The presence of French troops in Libya was first reported by French newspaper Le Monde, but denied by Libyan officials.

On Tuesday, Libyan officials told The Associated Press news agency that an "Islamic militia" had shot down a helicopter near the eastern Libyan city of Benghazi, killing two French officers, in an area called al-Magrun. French and Libyan officials have not provided information on where the third officer died.

Ahmed al-Mesmari, the spokesman for Haftar's forces, told reporters in Benghazi on Wednesday that the French were gathering intelligence on an affiliate of the Islamic State in Iraq and the Levant (ISIL, also known as ISIS) in Libya.

Mohamed Eljarh, a Libya analyst and non-resident Fellow at the Atlantic Council's Hariri Centre for the Middle East, said that it was "common knowledge" that Western forces were operating in the east and west of Libya in non-combat roles, mostly in advisory capacity.

"There have been air strikes by the Americans, and reportedly by the British, using drones - but not the French," Eljarh told Al Jazeera.

"What is interesting is that the personnel were targeted in a helicopter near the frontlines. That is where it gets a little bit blurry - was part of their mission a combat role, or was it not?"

'International community contradicting itself'

The confirmation of French special forces in Libya comes on the heels of the release of leaked tapes from the Benina air base, made public earlier this month, suggesting that British, French, Italian and US forces have been coordinating air strikes in support of Haftar.

Last year, Haftar launched a self-declared campaign to drive rebel fighters, including an al-Qaeda-affiliated group, from Libya's second biggest city, Benghazi. He has refused to support the UN-backed government because his forces were once loyal to a rival government.

READ MORE: Libyan forces make gains against ISIL in Sirte

Analysts said the deaths of the French soldiers exposed the international community's contradictions, with foreign military forces siding by rival groups and forces in Libya.

According to Eljarh, Western powers were dealing with Libya on two different levels: political and military.

"Western countries are saying that they support the GNA and are pushing for a unified Libya, but they are dealing with it on a security level as well, which is a more realistic level … They are willing to deal with anyone on the ground who has force and a record of fighting hardline groups," Eljarh said.

"It seems that the intelligence, and to an extent the military, do not have a problem working with groups even if they are opposed to the GNA. For me, this seems like the international community is contradicting itself. [Western countries] need to harmonise in order to achieve both their political and military goals."

Tripoli rallies

Meanwhile, hundreds of protesters demonstrated on Thursday in Tripoli against France's involvement in Libya, burning the French flag and calling for attacks on French business interests in the country.

Al-Sadeq al-Ghariyani, an ultraconservative cleric, denounced France's involvement as "foreign invasion".

"People in Libya think this is a French military intervention in Libya. They also think that France is supporting one side of the conflict on the ground in the east of Libya, especially in Benghazi," Al Jazeera's Mahmoud Abdulwahed, reporting from Tripoli, said.

Dodging an explanation as to why French special forces were operating in Libya, French Foreign Ministry spokesman Romain Nadal said on Thursday that "support for the Government of National Accord is a priority for France.

"France encourages all Libyan forces to be placed under the authority of the government to participate in the recovery of the country and the fight against terrorism."

After the 2011 ousting of longtime dictator Muammar Gaddafi by NATO-backed rebels, Libya slid into chaos and years later, it split into two governments and parliaments - each backed by a loose array of militias and tribes.

In December, a UN deal created a new unity government and presidential council, aiming to heal the rift and unite Libyan militias and forces under a joint command. However, the new government has been facing multiple challenges and resistance from various groups.

Meanwhile, Libya's pro-government militias - mainly from the western city of Misrata - have been waging a two-month offensive against ISIL in the group's last bastion in Sirte, a city on the Mediterranean.