Turkey's parliament has approved a bill to deploy troops to Libya in support of the embattled United Nations-recognised Government of National Accord (GNA), paving the way for increased military cooperation despite criticism from opposition legislators.

Parliament Speaker Mustafa Sentop said on Thursday that the legislation passed with a 325-184 vote.

The government has not revealed details about the possible Turkish deployment. The motion allows the government to decide on the scope, amount and timing of any mission.

More:

President Recep Tayyip Erdogan's ruling AK Party and its allies hold a parliamentary majority. All important opposition parties in the assembly voted against the bill.

Parliament cut short its winter recess to address developments in the Libyan capital, Tripoli, where GNA-aligned forces are countering a renewed push by eastern-based, renegade military commander Khalifa Haftar to wrest control of the city.

Following the announcement, US President Donald Trump warned Erdogan against any "interference" in Libya in a telephone call.

Trump "pointed out that foreign interference is complicating the situation in Libya," White House spokesman Hogan Gidley said in a statement.

GNA Prime Minister Fayez al-Sarraj and President Erdogan in November signed two agreements relating to maritime border demarcation and enhanced security cooperation.

Al Jazeera's Mohammed Adow, reporting from Ankara, said: "The governing party has the numbers to have sail the motion through.

"There was strong opposition from the members of parliament, particularly from the main opposition party -the CHP, which had argued that Turkey should not get sucked into a murky quagmire."

Libya in turmoil

Haftar's self-styled Libyan National Army (LNA) launched an offensive in April, but their advances were brought to a standstill by pro-government troops along the city's southern outskirts.

However, the reported introduction of Russian mercenaries from the private Wagner group in September upended the balance of power and allowed LNA troops to seize control of key towns south of Tripoli.

Alongside an increase in the number of UAE air raids in support of Haftar, the Russian developments seem to have emboldened Erdogan and hastened Turkey's intervention, which in the past was limited to the sale of military equipment.

"It wouldn't be right for us to remain silent against all of this," Erdogan said in December, referring to the presence of Russian fighters.

Since longtime leader Muammar Gaddafi was overthrown in 2011, Libya has not had a stable government.

Efforts to demobilise and reintegrate fighters who had helped topple Gaddafi into the formal security apparatus have largely failed.

Instead, the GNA has had to rely on a number of militias to defend the city.

But aside from their opposition to Haftar, analysts say authorities and the armed groups share few interests.

Haftar, who enjoys the support of a rival administration in the east, says he wants to restore order in the war-torn country.

But critics fear the strongman will plunge the country back into authoritarianism.

For the United Arab Emirates (UAE) and Egypt, key backers of the onetime Gaddafi loyalist, the 76-year-old represents a bulwark against political Islam that some in Tripoli have espoused.

Fighters loyal to the UN-recognised Government of National Accord (GNA), on board a military vehicle during clashes with forces loyal to strongman Khalifa Haftar, in Espiaa, about 40 kilometres (25 miles) south of the Libyan capital Tripoli on August 21, 2019 [Mahmud Turkia/AFP]

Analysts said ideological sympathies play a minor role in Ankara's decision to intervene in Libya.

"If look at a map of the Mediterranean, you'll see that to Turkey's west, Greece, Cyprus and Egypt are forming a sort of chokehold," said Sami Hamdi, a political analyst and editor in chief of the International Interest. "They're increasingly concerned that Turkey is becoming a major player."

Meanwhile, Turkey, which hosts the world's largest refugee population with 3.7 million Syrians, remains involved in the Syrian conflict diplomatically and militarily.

Ankara has called for a "safe zone" in northern Syria for some of the refugees in Turkey to return to.

Hamdi continued: "Add to that the way the US conceded to Turkish demands in Syria for a safe zone, when you see how Putin and Erdogan wrestle over Syria, the fact that Russia is keen on having good relations with Turkey - that all says that Ankara is emerging from the category of second-tier power.

"If Libya falls under Haftar, an ally of the United Arab Emirates, which is, in turn, antagonistic to Turkey, this essentially puts all of Turkish maritime interests at the mercy of the UAE, Egypt, Greece and possibly Italy."

But to intervene without coordinating with Russia would put the two countries on a collision course, a scenario that both want to avoid, Hamdi said.

Efforts are already underway to reach an understanding, according to Hamdi, which might include Turkey giving up Idlib in Syria, the last rebel stronghold, where stakes are much higher for Russia.

But Ali Bakeer, a Turkish political analyst, said it was possible for Ankara to reach an agreement with Moscow on Libya, without having to abandon Idlib.

"I rule out the swap agreement. Ankara and Moscow have to discuss options within the Libyan theatre itself," Bakeer said.

"It might include Turkey and Libya offering Russia economic opportunities in their newly designated areas, according to the latest maritime MoU between the GNA and the Turkish government."

Both Hamdi and Bakeer, however, agreed that Tripoli is a red line for the Turkish government, without which Ankara stands to lose a major ally and power projection outpost.

Marwan Bishara, Al Jazeera's senior political analyst, said the deployment of Turkish troops would alter the dynamic on the ground in Libya in favour of the government in Tripoli and against Haftar.

"The intention behind the intervention is not to escalate the war - it's actually the contrary. This is ... meant to end the attack on Tripoli, which has been under attack for six months.

"As the UN special envoy to Libya said, 'Haftar, and this is an understatement, is anything but a democrat'."