Turkish President Recep Tayyib Erdogan is upping the ante in Libya, shipping drones, tanks, special forces and commando units to the conflict-ravaged North African country. It seems he’s bidding to create a single strategic deadlock by merging two brewing conflicts: one in Libya, and one in the Eastern Mediterranean.

As Turkey’s military incursion against the Kurds in Northern Syria loses momentum, political tensions are rising on the domestic front. To help defuse them, Erdogan is looking for a joker in the pack in the form of a foreign enemy. And now, he seems to have chosen one.

On Sunday, Erdogan announced that Turkey is ready to send troops to Libya to prop up the UN-recognised government against a military offensive by general Khalifa Haftar that started last week.

But by acting out of his growing sense of insecurity and isolation, Erdogan hasn’t made just one overseas adversary; he’s infuriated most of his neighbours too.

Haftar’s fresh campaign was triggered by a new security deal signed by Ankara and the Tripoli government. The two sides have drawn up a memorandum of understanding to secure drilling rights in the Mediterranean.

Turkey launches offensive into Syria Show all 25 1 /25 Turkey launches offensive into Syria Turkey launches offensive into Syria Turkish soldiers with armored vehicles EPA Turkey launches offensive into Syria A woman flees with her children during Turkish bombardment on Syria's northeastern town of Ras al-Ain AFP/Getty Turkey launches offensive into Syria Smoke billows following Turkish bombardment on Syria's northeastern town of Ras al-Ain in the Hasakeh province along the Turkish border on October 9, 2019. - Turkey launched an assault on Kurdish forces in northern Syria with air strikes and explosions reported along the border. President Recep Tayyip Erdogan announced the start of the attack on Twitter, labelling it "Operation Peace Spring". (Photo by Delil SOULEIMAN / AFP) (Photo by DELIL SOULEIMAN/AFP via Getty Images) DELIL SOULEIMAN AFP/Getty Turkey launches offensive into Syria The first group of Turkish infantry prepare to enter Syria on the border Getty Turkey launches offensive into Syria Civilians flee AFP/Getty Turkey launches offensive into Syria Smoke billows from targets inside Syria AP Turkey launches offensive into Syria Turkish armoured vehicles enter Syria in Akcakale Getty Turkey launches offensive into Syria Civilians leave as smoke rises from Ras al-Ain AFP Turkey launches offensive into Syria A multi-rocket launcher fires in an unknown location Turkish Defence Ministry via Reuters Turkey launches offensive into Syria People wave as Turkish soldiers prepare to cross the border Getty Turkey launches offensive into Syria Girls stand together in Ras al Ain town Reuters Turkey launches offensive into Syria A woman walks as smoke billows following Turkish bombardment in Syria's northeastern town of Ras al-Ain AFP/Getty Turkey launches offensive into Syria A Turkish army's tank drives down from a truck towards the border with Syria AFP/Getty Turkey launches offensive into Syria Turkish jet taxis on tarmac after returning to a military base in southeast Diyarbakir Reuters Turkey launches offensive into Syria A Turkish armored vehicle drives down a road during a military operation in Kurdish areas of northern Syria EPA Turkey launches offensive into Syria People sit on belongings at a back of a truck as they flee Ras al Ain town Reuters Turkey launches offensive into Syria Turkey-backed Syrian opposition fighters enter Tel Abyad AFP/Getty Turkey launches offensive into Syria Civilians flee AFP/Getty Turkey launches offensive into Syria People flee Tal Abyad North Press Agency/Reuters TV Turkey launches offensive into Syria People wave as Turkish soldiers prepare to cross the border into Syria Getty Turkey launches offensive into Syria Civilians flee with their belongings AFP/Getty Turkey launches offensive into Syria Civilians flee during Turkish bombardment on Syria's northeastern town of Ras al-Ain in the Hasakeh province along the Turkish border on October 9, 2019. - Turkey launched a broad assault on Kurdish-controlled areas in northeastern Syria today, with intensive bombardment paving the way for an invasion made possible by the withdrawal of US troops. (Photo by Delil SOULEIMAN / AFP) (Photo by DELIL SOULEIMAN/AFP via Getty Images) DELIL SOULEIMAN AFP/Getty Turkey launches offensive into Syria Turkish President Recep Tayyip Erdogan, right, speaks with Defense Minister Hulusi Akar, left, as they watch the operation by Turkish forces in Kurdish areas EPA Turkey launches offensive into Syria Smoke rises from the Syrian town of Tal Abyad AFP/Getty Turkey launches offensive into Syria Turkey-backed members of Syrian National Army prepare for moving to Turkey with heavy armed vehicles EPA

Over the last five years, the Eastern Mediterranean has witnessed major discoveries of gas fields in Greece, Cyprus and Israel. But it was the discovery of the Egyptian Zohr field, the biggest gas field in the Mediterranean, that was seen as a game changer, paving the way for Egypt to be the region’s energy hub.

The Eastern Mediterranean Gas Forum was duly formed – and while it includes most of the region’s states in its membership, Turkey is excluded. For Erdogan, this was a move to stack the cards against his country, and he felt eager to retaliate.

The new agreement sets out a peculiar process for mapping out maritime boundaries between Turkey and Libya, which are neither neighbors nor have boundaries to share. The lines now drawn encroach on the economic zone of the Greek island of Crete, as well as violating the Sukhairat Agreement that shores up the Tripoli government’s legitimacy.

In response to Turkey’s latest move to trample over other countries’ rights in the Mediterranean, Greece has filed a complaint to the Security Council, while Egypt has carried out live-fire military manoeuvres near its Mediterranean coast. And at their summit last week, the EU Leaders declared the agreement a violation of international law.

Turkey hardly seems inclined to back down. After Erdogan pledged to send his troops to Libya, Turkish-backed northern Cyprus received drones to help Turkey’s gas excavation projects near the island.

But establishing a military base in Libya could prove to be Erdogan’s biggest strategic blunder. In particular, it goes against Egypt and the UAE, who have for years backed Haftar in his efforts to capture Tripoli.

All the while, Turkey’s old man is going through his biggest domestic political struggle yet.

Ahmet Davutoglu, a former prime minister and former ally to the president, launched last week a new political party, which many in Erdogan’s ruling Justice and Development Party (AKP) view as a direct threat. And now, former deputy prime minister and ex-heavyweight Erdogan ally Ali Babacan is expected to announce his own breakaway party soon.

Meanwhile the opposition mayor of Istanbul, Ekrem Imamoglu, has seen his popularity skyrocket. Many in Turkey believe that Abdullah Gul, the former president and founder of the AKP, might step in soon to help turn the tide against the president.

When the Turkish military invaded northern Syria, Erdogan cleverly deployed nationalistic rhetoric to win domestic support for his shady business in the neighbouring country. But he should be under no illusion that his people will be easily sold on this latest venture. He is risking the deaths of possibly hundreds of Turkish soldiers to defend an Islamist-backed government thousands of miles away. It’s hard to see the appeal.

Yet for now, Erdogan seems content to put Turkey’s turbulent politics out of his mind. For him, the lack of domestic legitimacy for his ambitions in Libya can always be subject to a trade-off with another kind of legitimacy in the west.

Reports have recently surfaced that Russia has increased its military support for Haftar’s National Army, which controls most of Libya’s strategic oil fields in Libya. President Vladimir Putin’s audacious move dropped the jaws of Trump’s administration.

Erdogan is playing on this very American fear of the heavy Russian military presence in North Africa. The Americans know that Russia is trying to copy president Trump’s strategy of keeping American troops in Syria in order to maintain control over the oil fields, this time in Libya.

Erdogan also understands that Haftar’s assault on Tripoli doesn’t have the West’s support. For that, he is hoping to present himself as a reliable, legitimate and a western-backed counterbalance.

Erdogan may not be bluffing about deploying troops to Tripoli and flexing his muscles against Cyprus, but upping the stakes in the backyard of such powerful players like the EU, Egypt and Israel is a risky business.