The announcement that Turkey and Israel have agreed on pre-conditions for resuming full diplomatic relations comes as a diplomatic bombshell in both countries. After secret talks in Switzerland between the head of the Turkish foreign ministry and the head of Mossad, the Israeli intelligence service, it was announced on Thursday that agreement has been reached – though not yet signed – on an exchange of ambassadors.

This, it was announced, is to be the preliminary to the opening of discussions about building a natural gas pipeline from Israel’s off-shore gas fields to Turkey. Officials stress that it is not yet certain that the deal will go ahead, though last weekend, President Recep Tayyip Erdogan himself called a rapprochement with Israel to be "crucial for the region". Another harbinger of the news was the fact that a few days earlier, without explanation, the Jewish winter feast of Hanukkah was for the first time celebrated publicly in Istanbul.

News of the proposed deal was not welcomed universally in Turkey. The Islamic Humanitarian Relief Foundation (IHH), 10 of whose members died when the Mavi Marmara Flotilla was attacked by Israeli forces in May 2010, denounced the news, saying it would hurt the peoples of Turkey and the Middle East. But a leading pro-Islamist paper, Yeni Akit, claimed Turkey had secured a major triumph by getting the embargo against Gaza lifted – a claim that is not yet confirmed.

The sudden turn-around comes after half a decade when Turkish-Israeli relations looked close to extinction. A succession of fierce confrontations under the AKP government seemed to have killed off the close, though low-profile, Turkish-Israeli partnership which began in 1949 and flourished in Kemalist Turkey during the Cold War and after, extending into industrial, particularly defence industrial, cooperation.

Two particularly fierce flare-ups signalled the apparent parting of the ways between the two countries. Both were related to the fate of the occupied Palestinian territories, especially the besieged Gaza Strip. The first was the angry walk-out by President Erdogan on live TV from the World Economic Forum at Davos in January 2009 after berating the Israeli president, Shimon Peres, over the Israeli bombardment of Gaza. The second came 16 months later with Israel’s assault on the Mavi Marmara humanitarian aid convoy to Gaza in May 2010.

With Turkey growing increasingly less secular and more focused on Middle Eastern politics, and with the leaders of both countries evidently sharing a strong mutual distaste for each other, it looked as if Israeli-Turkish relations would never recover. In particular it seemed Turkey could never contemplate a deal with Israel while the Gaza problem continued to fester.

However, relations between the two countries are also important to a third party, the United States, which is a close ally of both and which has probably played a leading role behind the scenes in brokering this week’s agreement.

The US helped get some diplomatic links restored in March 2013, when under prodding from President Barack Obama, Israeli Prime Minister Benjamin Netanyahu offered an apology to President Erdogan in regard to the Mavi Marmara assault.

In January this year, a new Israeli charge d’affaires arrived in Ankara, but there was still no sign of a real thaw. Even if officials in both countries wanted a rapprochement for trade and strategic reasons, their leaders were set against it. Furthermore, once-friendly public opinion in both countries seems also to have hardened over time into something resembling permanent popular antipathy.

Yet, despite their fairly open dislike of each other, Turkey and Israel seem to have discovered that they need each other: both as possible regional partners and energy partners.

The years in which Turkey and Israel were falling out were also ones in which large reserves of offshore natural gas were being found by Israel. Between them, its two largest proven reserves, Tamar and Leviathan, total about 780 cubic km - enough to make Israel a significant supplier internationally for several decades.

For most of the period since then, Turkey has apparently not figured in Israel’s thinking about how to dispose of its bonanza, and there is still uncertainty about future development.

At first Israel seems to have been unsure how to make use of its natural gas, but one obvious route is a deal with Cyprus, something that would at first sight neatly lock out Turkey though probably at the cost of permanently ramping up tensions in a corner of the eastern Mediterranean already full of political conflict. The idea of cooperation along those lines is still around.

A memorandum of understanding was signed between Israel, Cyprus, and Greece less than two months ago, but it was only a shadow of hopes two or three years earlier to have Israeli gas actually travelling to Cyprus by this year.

If Israel plans to export its gas, Turkey would be a much easier destination than Greece. It also offers a large potential market one which, since Turkey’s rift with Russia after the downing of a Su-24 Russian fighter jet on 24 November, is looking for potential new suppliers.

Given the uncertainties (not least the likely need to involve the Greek Cypriots, for many decades Turkey’s inveterate regional foes), it is far from clear that a deal on these lines can go ahead, though it is unlikely that news of the agreement would have been made public unless work on this project was relatively far advanced.

It is also curious that only two months ago, Israel and Russia were discussing possible involvement of the Russia’s gas company, Gazprom, in developing and marketing gas from the larger Israeli field, Leviathan. Would this be compatible with creating a pipeline to Turkey intended to substitute for Russian gas imports?

For energy cooperation to go ahead, Turkey and Israel must first normalise their relations, as the Turkish energy minister, Berat Albayrak (who is also Erdogan’s son-in-law) declared on Thursday. Albayrak indicated that the pipeline he envisages is an ambitious project carrying gas on from Turkey to Europe.

Meanwhile, to patch up their former quarrel, Israel is to pay $20 million compensation to families of the men it killed in the Mavi Marmara incident in 2010, while Turkey will drop legal proceedings against their presumed killers and exclude a leading Hamas figure from Turkey.

It is a fragile deal, highly vulnerable to a new flare-up in Gaza, and it may yet come to nothing. But it is something that a month ago, before Turkey downed the Russia Su-24, could not even have been imagined.

- David Barchard has worked in Turkey as a journalist, consultant, and university teacher. He writes regularly on Turkish society, politics, and history, and is currently finishing a book on the Ottoman Empire in the 19th century.

The views expressed in this article belong to the author and do not necessarily reflect the editorial policy of Middle East Eye.

Photo: A billboard on a main street by the Ankara municipality to thank the then Turkish Prime Minister, currently President Recep Tayyip Erdogan reads: "We are grateful to you" in Ankara, on 25 March, 2013, three days after Israeli Prime Minister Benjamin Netanyahu apologized to Turkey over the death of nine Turkish citizens on board a Gaza-bound flotilla in 2010 (AFP).