At Friday prayers at the Al Aqsa Mosque in East Jerusalem, the faithful often hold up portraits of Recep Tayyip Erdogan, the Turkish president, worshipping under the gleaming gold crescent on the Dome of the Rock that was paid for by Turkey. Mr Erdogan’s popularity with Palestinians reflects his long championing of their struggle for nationhood and comes as their cause has slid down the list of regional concerns, sidelined by Israel’s wooing of the Gulf states . He has stepped into that vacuum, coupling his adventures in Libya and Syria with a desire to wield influence in the Israeli-Palestinian conflict.

For Israel the most troubling aspect is his embrace of Hamas, the militant group that controls the Gaza Strip, and is considered a terrorist group by Israel, the EU and the US.The US, a close Israel ally, has also voiced concerns. Last month, in a rare public statement on this relationship, it strongly objected to Mr Erdogan hosting two Hamas leaders in Istanbul, chiding him for his “outreach to the terrorist organisation”.

The US rebuke came after Mr Erdogan tweeted a photo of his meeting with Hamas figures, including Saleh al-Arouri, a prominent military commander who worked in Lebanon, Syria and the occupied West Bank.

There’s a broader struggle still underway over the contours of the regional order, and that is partly what motivates him 

Sarah Feuer, a fellow at the Washington Institute for Near East Policy and the INSS in Tel Aviv

“There are both geopolitical and ideological considerations here,” said Sarah Feuer, a fellow at the Washington Institute for Near East Policy and the INSS in Tel Aviv, referring to Turkey’s regional rivalry with the UAE and Saudi Arabia. “Erdogan sees emerging alliances in the region as a threat but he’s also presenting himself as the leader of the Muslim world and flag bearer for Islamist movements, to counter the Emirati-Saudi­ Egyptian camp. There’s a broader struggle still under way over the contours of the regional order, and that is partly what motivates him.”

“It fits in perfectly”, said a UN official, who has mediated between Israel and Hamas for nearly a decade. “Find the one thing that Israel doesn’t have an answer to, doesn’t know how to manage and can’t get rid of, and make it your own personal vanity project.”