From a symbol of Christendom after its establishment by Byzantine emperor Justinian I in the sixth century, to an emblem of the Muslim Ottoman Empire's sprawling influence, the Hagia Sophia has been at the heart of a centuries-old ideological and political battle.
After Fatih Sultan Mehmed II conquered Constantinople in 1453 and brought the city - which later became known as Istanbul - into the fold of Islam, he converted the Hagia Sophia from a cathedral to a mosque.
For hundreds of years, Muslim worshippers from around the world flocked to the city's red-coloured architectural jewel to perform their daily prayers as it stood high with its imposing grey dome and towering minarets.
But in the early 1930s, Mustafa Kemal Ataturk, the founder of the modern Turkish republic, closed the mosque and turned the building into a museum as part of his drive to secularise and modernise the country.
Calls to reconvert the Hagia Sophia, also known as the Ayasofya, back into a mosque have since been on the rise.
Growing sharper in recent years, the demand came mostly from Turkey's religious-leaning and nationalist constituencies, many of whom regularly demonstrated at the gates of the Hagia Sophia every May 29, the anniversary of the Ottoman conquest of Constantinople.
But such calls have been vehemently opposed by Greece and the United States, which argue that the heritage site - recognised by the United Nations Educational, Scientific and Cultural Organization (UNESCO) since 1985 - should remain a museum out of respect for the country's Christian minority and world history.
'Aura of legitimacy'
On Thursday, Turkey's Council of State, the country's highest court, is set to decide the status of the Hagia Sophia following a petition by a private association to examine the validity of Ataturk's 1934 decree that converted it into a museum.
Although previous lawsuits to change the status of the museum have failed, lawmakers say a court decision is only symbolic.
"The court's favourable decision could provide an aura of legitimacy to the museum's conversion into a mosque, but it is not a prerequisite," said Aykan Erdemir, senior director of the Turkey Program at the Foundation for Defense of Democracies and a former parliamentarian.
The former Turkish lawmaker added that President Recep Tayyip Erdogan's opinion on the matter was, on the other hand, key to the final status of the building.
Ozturk Yilmaz, an independent member of the Turkish parliament and former ambassador, agreed: "This is not a legal matter. If the government wants to change the museum into a mosque, it only requires a presidential decree. The high court's ruling merely adds legitimacy."
Although sympathetic to the cause in his youth, Erdogan has largely remained silent on the public debate over the status of the Hagia Sophia since he came to office 18 years ago. He even reticently opposed the calls on one occasion, telling advocates to fill the Ottoman-built Blue Mosque next door instead.
But since 2019, his rhetoric has changed, with Erdogan publicly endorsing the conversion twice. The first time came right before the March 2019 municipal elections when fears were high that his ruling Justice and Development (AK) Party would lose Istanbul to the opposition's Ekrem Imamoglu - now the mayor of Turkey's cultural capital.
Erdogan told his supporters at the time that he planned the conversion in response to US President Donald Trump's recognition of Israel's move to make Jerusalem its capital.
Observers saw Erdogan's recent endorsements as a political ploy to distract attention from the country's weakening economy, the coronavirus pandemic and his own waning popular support.
"The timing of these two calls suggests a strong link between domestic political considerations and the instrumentalisation of Hagia Sophia," Erdemir told Al Jazeera.
Erdogan appeared on a large screen in the Haiga Sophia to deliver a virtual speech on May 29 as part of the 576th anniversary celebrations of the Ottoman capture of Istanbul.
That same month, he rebuked Greek anger over the potential change in a television interview, saying, "They dare telling us not to transform Haiga Sophia into a mosque. Are you ruling Turkey, or are we?"
Framing the issue as a matter of national sovereignty, advocates have garnered wide support among the majority of Turks, who regardless of their ideological opinions see the status of the building as a purely domestic affair.
"This decision is a national matter. International players should not get involved," said Yilmaz, who is also a former member of the Turkey's main opposition Republican People's Party (CHP), which was established as a pro-secular party by Ataturk.
Further kindling national sentiments, Erdogan has reportedly instructed his advisory council to hold the first prayers at the Hagia Sophia on July 15 to commemorate the four-year anniversary of the 2016 failed coup attempt against his own government.
Not a domestic controversy
For Hamdi Arslan, a Turkish academic and longtime supporter of the cause, Hagia Sophia holds "both religious and symbolic significance," he told Al Jazeera, while reminiscing over the times he demonstrated alongside Erdogan at its gate in the 1970s.
"For 50 years, I've been waiting for the shackles around the Hagia Sophia to be removed and its original identity as a mosque restored. We won't give up on that," he said.
According to Galip Dalay, a Tukey specialist and fellow at the Robert Bosch Academy, the potential move has not been controversial domestically, but rather on the international stage.
"The controversy isn't inside Turkey, but between Ankara and the EU [European Union], Greece or even the US. None of the political parties oppose the idea of opening the Hagia Sophia as a mosque," said Galip.
"That's because most parties either support this move or they don't want to give Erdogan another tool to polarise society because they know the majority of Turks are for it."
A poll published last month found 73 percent of Turks were in favour of the conversion.
Faik Ozturk, the spokesperson of CHP, Turkey's main opposition party, warned Erdogan last month against exploiting the move.
While Turkey's opposition and religious minority groups have not spoken out strongly against it, Erdemir explained it has been "near impossible for Turkey's religious minorities and pro-secular constituencies to oppose Hagia Sophia's conversion publicly since they would become easy targets for accusations of religious and national betrayal".
He added the potential conversion would damage the image of Turkey "in the eyes of two billion Christians worldwide", and "alarm Turkey's religious minorities and pro-secular constituencies".
Last month, the Greek ministry appealed to UNESCO over the potential decision, claiming such a move would violate international conventions.
Condemnations also came from UNESCO itself and the US ambassador, while Ecumenical Patriarch Bartholomew, who represents the Orthodox Christian world, said he was "saddened and shaken" by concerns the possible conversion would be a cause of division.
Despite the potential international backlash, Yilmaz, the Turkish lawmaker, said: "It's time for the reconversion to happen so that this issue can no longer be politically exploited by Erdogan or anyone else."