Turkish President Recep Tayyip Erdogan has told supporters that he plans to convert Istanbul's Hagia Sophia landmark into a mosque as a response to US President Donald Trump's recognition of Israel's claims to occupied East Jerusalem and the Golan Heights.

Erdogan has made the future status of the UNESCO world heritage site, one of Turkey's most iconic tourist attractions, a central theme of his final days of campaigning for Sunday's local elections as he strives to shore up support among his conservative support base.

Speaking on Tuesday at a Justice and Development Party (AKP) rally in Istanbul, where the party is fighting to see former prime minister Binali Yildirim elected as mayor, Erdogan said: “We said we would lift Hagia Sophia’s museum status and return it to its original state and call it a mosque.”

Hagia Sophia was originally built as a cathedral by the Byzantine Emperor Justinian 1, but it was converted into a mosque after the Ottoman conquest of Istanbul in the 15th century.

Mustafa Kemal Ataturk, the founder of modern Turkey, turned the structure into a museum, but the building's status has remained a sensitive issue among Turkish conservatives ever since.

'Fill the Blue Mosque'

Erdogan's declaration appears to indicate a change of heart in recent weeks after he had earlier rejected calls for Hagia Sophia to be converted into a mosque as a response to the murder of Muslim worshippers at two mosques in New Zealand earlier this month.

Speaking at a rally in the western city of Tekirdag, Erdogan had told supporters to instead fill the Ottoman-built Blue Mosque, which faces Hagia Sophia in Istanbul's Sultan Ahmet neighbourhood.

“First you should fill the Blue Mosque next door. Go to the Camlica Mosque we built. Fill that one,” he said.

Speaking on Tuesday, Erdogan suggested that he had changed his mind in the wake of US recognition of Israeli sovereignty over the occupied Golan Heights last week, and also linked the move to US recognition of Jerusalem as Israel's capital last year. Jerusalem's occupied Old City is the site of numerous significant historic and religious sites including the Al-Aqsa Mosque.

“Now, Trump tries to declare Jerusalem as [Israel’s] capital. He is giving the Golan Heights to occupier Israel. Of course, you will get a response from Turkey” he said.

He added that Turkey needed to issue a response to Israel and the US because it had a responsibility as the current president of the Organisation of Islamic Cooperation (OIC).

A sign of desperation?

Erdogan supporters welcomed the decision on social media.

Tugrul Selmanoglu, a conservative social media personality whose videologs from Germany are widely circulated on Turkish social networks, shared Erdogan’s announcement on Twitter and said, “I can’t get enough of this”.

İzle izle doymuyor insan... Ayasofya... pic.twitter.com/PxtPcKFZma — Tuğrul SELMANOĞLU (@tselmanoglu) March 26, 2019

Critics say Erdogan brought up the idea as part of his election strategy since recent polls showed his ruling Justice and Development Party (AKP) could lose control of Istanbul and Ankara in Sunday's elections amid frustration about the country's economic recession.

“He doesn’t have much in his hands [to use]. That’s why he is using the very first thing that comes to his mind. I think this is a sign of desperation since he decided to use Hagia Sophia only a couple of days before the elections,” said Rusen Cakir, a veteran journalist who runs the independent media platform Medyascope.

Greek Foreign Minister George Katrougalos criticised Erdogan's remarks on Tuesday, saying: "Any questioning of this status is not just an insult to the sentiments of Christians, it is an insult to the international community and international law."

The Greek Orthodox church traces its history to the Byzantine empire and its Patriarch is still based in Istanbul, which was formerly known as Constantinople.

Greek media, citing unnamed UNESCO officials, also reported on Wednesday that any change to Hagia Sophia’s status would necessitate approval by the organisation.