Turkey's parliament passed a bill on Thursday approving a military deployment to Libya aimed at shoring up the Tripoli-based Government of National Accord (GNA), at a time of intensifying international tensions over the conflict.
The beleaguered Tripoli government has been under sustained attack since April by the Libyan National Army, commanded by General Khalifa Haftar.
Egypt strongly condemned the Turkish vote, saying it amounted to a "flagrant violation of international law and Security Council resolutions on Libya".
President Recep Tayyip Erdogan spoke with his US counterpart Donald Trump by phone on Thursday to discuss the situation in Libya, his office said.
He is due to receive Russian President Vladimir Putin next Wednesday to inaugurate a new gas pipeline, and Libya is expected to be a key topic of discussion.
Erdogan has repeatedly accused Russia of sending private mercenaries to support Haftar's forces, though this has been denied by Moscow.
However, Turkey and Russia have managed to work closely on the Syrian conflict despite supporting opposing sides, and are expected to seek a similar balancing act with regards to Libya.
Erdogan's office confirmed last Friday that a request for military support had been received from the GNA.
No details have been given on the scale of the potential deployment, and Vice-President Fuat Oktay told state news agency Anadolu on Wednesday that no date had yet been set.
"We are ready. Our armed forces and our defense ministry are ready," he said, adding that parliamentary approval would be valid for a year.
He described the parliament motion as a "political signal" aimed at deterring Haftar's LNA.
"After it passes, if the other side changes its attitude and says, 'OK, we are withdrawing, we are abandoning our offensive,' then what should we go there for?"
The bill, opposed by all major opposition parties, passed with an 315-184 vote. Opposition parties said the move may exacerbate conflicts in Libya and endanger Turkish soldiers in the region and Turkey’s national security.
But Erdogan’s spokesman Ibrahim Kalin said the bill was an important step for protecting Ankara’s interests in North Africa and the Mediterranean, and for achieving peace and stability in Libya.
In a statement to Reuters, the GNA’s interior minister Fathi Bashagha said Tripoli had requested Turkish support following a “dangerous escalation” in the conflict by Haftar’s forces.
Dmitry Novikov, a Russian lawmaker, said after the vote that a Turkish military presence in Libya would “only deteriorate the situation”, according to the Interfax news agency.
"The Libyan motion is important for the protection of the interests of our country and for the peace and stability of the region," Foreign Minister Mevlut Cavusoglu tweeted after the vote.
But analysts and some officials say Ankara is unlikely to immediately deploy troops, instead sending military advisers and equipment first.
“The hope would be that the Turkish military may not itself be involved in military action,” said Sinan Ulgen, a former Turkish diplomat who is chairman of the think-tank Center for Economics and Foreign Policy Studies.
Last week, a senior Turkish official said Ankara could train Libyan soldiers in Turkey, and Reuters reported that Turkey may also consider sending allied Syrian fighters to Tripoli as part of the planned military support.
Turkey has used its alliance with the GNA to advance other interests.
It signed a military cooperation agreement with the GNA during a visit by its leader, Fayez al-Sarraj, to Istanbul in November.
But they also signed a maritime jurisdiction agreement giving Turkey rights to large swathes of the Mediterranean where gas reserves have recently been discovered.
The agreement drew international criticism, particularly from Greece which says it ignores its own claims to the area.
Analysts say Ankara was responding to being frozen out of regional energy deals, notably the "East Mediterranean Gas Forum", formed this year by Cyprus, Greece, Egypt, Israel, Jordan, Italy and the Palestinian territories.
Turkey's fierce rivalry with the military government in Egypt is seen as another motivating factor behind the planned deployment.
Erdogan strongly backed Egypt's Muslim Brotherhood government that was overthrown in 2013.
Haftar has previously ordered his forces to target Turkish companies and arrest Turkish nationals. Six Turkish sailors were briefly held by his forces over the summer.