Turkey and Israel have agreed to bury their differences after a bitter dispute froze relations between the two countries for six years. Normal diplomatic relations, including ambassadors in each other's capitals, have now been restored. Given the long-standing public distaste of Turkish President Recep Tayyip Erdogan for Israel and Turkish support for the people of Gaza, the news of the agreement marks a massive policy turnaround. However, it has been in the making for a while. To soften the shock, news of the deal – some pro-government papers in Turkey are even using the word “reconciliation” – between Turkey and Israel was signalled well in advance of its announcement two weeks ago. Erdogan also phoned Palestinian President Mahmoud Abbas to give him the news in advance. News of negotiations between Turkey and Israel has in fact been emerging steadily since late last year, with reports that despite their differences the two countries had discovered that they needed each other as both regional and energy partners. Unfinished business from the recent past is being got out of the way. Israel will now pay Turkey $20 million as compensation to the families of the 10 Turkish citizens who died in May 2010 when the Israeli military stormed an unarmed humanitarian convoy carrying relief supplies to Gaza. It has also renewed its apology, first issued in 2013, for the attack. The payment of the compensation by Israel, withheld until now, makes the apology more substantial. Israel will also allow a 10,000 ton shipload of humanitarian supplies from Turkey to unload in Gaza. Both sides are portraying the agreement as a victory of sorts. Turkish Prime Minister Binali Yildirim has said that Turkey has secured the easing (though not the complete lifting) of the Israeli blockade on Gaza. Turkey is also building homes and engaging in other projects to help the people of Gaza, and Hamas officials will continue to operate from offices in Turkey. However, according to Israeli Prime Minister Benjamin Netanyahu, the Gaza blockade will continue, while Israel will now be able to strike an agreement with Turkey for the export of gas from its newly discovered reserves via a pipeline to Europe. The two prime ministers issued details of the agreement simultaneously, perhaps in order to lessen domestic criticism in both countries. For this is an agreement dictated on both sides not by sentiment but by realpolitik. With memories of the events of 2010 and afterwards still fresh in many people's minds, the agreement also looks vulnerable to any possible fresh flare up in Gaza. But for the countries making it, the agreement is solidly underpinned by practical advantages on both sides. For Ankara, one benefit of the agreement with Israel is that it reduces Turkey's regional isolation and the number of neighbours with which it does not have diplomatic relations. Turkish-Israeli relations were always partly the product of the more important alliance both countries had with the United States, and this is still part of the picture. US President Barack Obama has been pressing both states towards reconciliation ever since 2010. In the spring of 2013 he succeeded in persuading Netanyahu to offer Turkey an apology for the deaths of the Turkish citizens, a move which led the way to an ice-breaking telephone call between the prime ministers of the two countries, the first step towards the recent deal. The most obvious loose thread in the arrangement is the future of Hamas, which until now has received strong Turkish backing but whose presence in Turkey will now be confined to conventional diplomatic activity. A recent secret meeting between the intelligence chiefs of Turkey and Israel is believed to have ensured that even if the Hamas office in Turkey remains open, there will be clear restrictions on what its officials are able to do in it. The geopolitics of the Middle East have shifted in the last half decade, and alliances which were once unthinkable are now beginning to be talked about. Yahya Bostan, a journalist on the pro-government Turkish Daily Sabah newspaper, says that the deal may be the prelude to a new “alliance for stability” in the Middle East. This could even, Bostan hints, include Egypt if its government is minded to join – a remarkable suggestion in view of the unfriendliness which has prevailed between Ankara and Cairo in the three years since the removal of Muslim Brotherhood former president Mohamed Morsi in Egypt. The obvious basis for the new Turkish-Israeli partnership is the export of Israeli natural gas. This, too, has been under discussion since last year, and Berat Albayrak, the Turkish minister of energy and son-in-law of Erdogan, went on record last year as saying that an energy deal with Israel would require a political deal as well. Netanyahu now sees Turkey as the optimum route to export gas from its Tamar and Leviathan reserves, with a pipeline running across the country carrying gas to Europe. Turkey has also been looking for potential alternative suppliers of natural gas to take the place of the Russians since relations between the two countries were frozen following the downing of a Russian air force jet on the Syrian border on 24 November last year. Israeli gas would be a logical alternative to Russian for Turkey, at least for some years ahead. However, there have also been signs that Russia's diplomatic and economic freeze against Turkey could be about to lift, and Erdogan recently issued a statement regretting the Russian jet incident. Though Russia seemed to have set its face firmly against relations with Turkey and had banned all agricultural imports, there have been signs over the last few weeks that Moscow had been responding slowly to indications from Turkey that it wants to normalise relations. The freeze in Turkish-Russian relations has not only hit Turkish food producers. Hotel bookings in Turkey by Russian visitors are said to be nearly 98 per cent down, and there has been uncertainty about future energy cooperation, including the construction of Turkey's first nuclear power plant at Akkuyu on the Mediterranean coast. Turkey's media has continued to criticise Russian operations in Syria, but both Erdogan and Yildirim have made it clear that they want the restoration of relations. The sticking point was the formal apology from Erdogan for the shooting down of the Russian jet and the death of one of its pilots. According to Russian media sources, later confirmed by Ibrahim Kalin, a spokesperson for the Turkish president, it seems that Erdogan used a form of words in a private letter to Russian President Vladimir Putin asking relatives of the dead pilot to “excuse us” for the action. Putin seems to regard this as a sufficient form of apology from Turkey, so normal relations look like they could be resumed. If that happens, one of Moscow's main moves is likely to be a continued guarantee of Russian natural gas supplies to Turkey, which in any case have so far not been interrupted. How far this would undermine a potential Turkish deal with Israel by removing the need for Turkey to buy additional gas is unclear, but having come so far towards a deal neither Turkey nor Israel looks likely to turn back easily. The writer has worked in Turkey as a journalist and university teacher and writes regularly on Turkish politics and society.