Turkey's parliament has approved the deployment of troops to Libya aimed at shoring up the UN-backed government in Tripoli, sparking a blunt warning from US President Donald Trump against any "foreign interference" in the war-torn country.
Libya has been beset by chaos since a NATO-backed uprising toppled and killed dictator Moamer Kadhafi in 2011, with rival administrations in the east and the west vying for power.
The beleaguered Tripoli government, headed by Fayez al-Sarraj, has been under sustained attack since April by military strongman General Khalifa Haftar, who is backed by Turkey's regional rivals - Saudi Arabia, Egypt and the United Arab Emirates.
In response to the prospect that Ankara might intervene after Thursday's vote, Trump had told his Turkish counterpart Recep Tayyip Erdogan in a call "that foreign interference is complicating the situation in Libya," White House spokesman Hogan Gidley said in a statement.
Egypt also strongly condemned the Turkish vote, saying it amounted to a "flagrant violation of international law and Security Council resolutions on Libya", while Israel, Cyprus and Greece denounced a "dangerous threat to regional stability".
Libya's elected parliament in the east - allied with Haftar - called Turkey's prospective military intervention "high treason".
President Erdogan 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.
At the same time, 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 internationally recognised Tripoli-based Government of National Accord (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 defence 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.
"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 passed easily by 325 votes to 184.
"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.
A UN report in November said several countries were violating the arms embargo on Libya in place since the overthrow of Kadhafi in 2011.
Jordan and the UAE regularly supply Haftar's forces, it said, while Turkey supports the GNA. Turkish and Emirati drones were spotted in Libyan skies during clashes over the summer.
"We're supporting the internationally recognised legitimate government in Libya. Outside powers must stop supporting illegitimate groups against the Libyan government," Erdogan's communications director Fahrettin Altun tweeted last week.
Turkey has used its alliance with the Tripoli government to advance other interests.
It signed a military cooperation agreement with the GNA during a visit by its leader 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 violently overthrown by Egyptian President Abdel Fattah al-Sisi 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 during the summer.