A Turkish court on Friday annulled a 1934 government decree that had turned Istanbul's Hagia Sophia into a museum, opening the way for the sixth-century building to be converted back into a mosque.
President Tayyip Erdogan, whose ruling AK Party sprung from political Islam, has said the cavernous domed building should revert to being a place of Muslim worship.
Hagia Sophia is nearly 1,500 years old and served as one of the most exalted seats of Christian and then Muslim worship in the world, meaning that any change to its status will have a profound impact on followers of both faiths. It is also a UNESCO World Heritage Site.
Here are the key facts of Hagia Sophia's history, the campaign to change its status, and statements by religious and political leaders about its fate.
Hagia Sophia, or 'Divine Wisdom' in Greek, was completed in 537 by Byzantine emperor Justinian.
The vast structure overlooked the Golden Horn harbour and entrance to the Bosphorus from the heart of Constantinople. It was the centre of Orthodox Christianity and remained the world's largest church for centuries.
Hagia Sophia stayed under Byzantine control - except for a brief seizure by Crusaders in the 13th century - until the city was captured by Muslim forces of the Ottoman Sultan, Mehmet the Conqueror, who converted it into a mosque.
The Ottomans built four minarets, covered Hagia Sophia's Christian icons and luminous gold mosaics, and installed huge black panels embellished with the names of God, the prophet Mohammad and Muslim caliphs in Arabic calligraphy.
In 1934 Turkey's first president, Mustafa Kemal Ataturk, forging a secular republic out of the defeated Ottoman Empire, converted Hagia Sophia into a museum, now visited by millions of tourists every year.
A Turkish association committed to making Hagia Sophia a mosque again has pressed Turkish courts several times in the last 15 years to annul Ataturk's decree.
In the latest campaign, it told Turkey's top court that Ataturk's government did not have the right to overrule the wishes of Sultan Mehmet - even suggesting that the president's signature on the document was forged.
That argument was based on a discrepancy in Ataturk's signature on the edict, passed around the same time that he assumed his surname, from his signature on subsequent documents.
Erdogan, who has championed Islam and religious observance during his 17-year rule, supported the Hagia Sophia campaign, saying Muslims should be able to pray there again and raised the issue - which is popular with many pious AKP-voting Turks - during local elections last year.
Turkish pollster Metropoll found that 44% of respondents believe Hagia Sophia was put on the agenda to divert voters' attention from Turkey's economic woes.
The pro-government Hurriyet newspaper reported last month that Erdogan had already ordered the status be changed, but that tourists should still be able to visit Hagia Sophia as a mosque and the issue would be handled sensitively.
Outside Turkey, the prospect of change has raised alarm.
- Ecumenical Patriarch Bartholomew, spiritual head of 300 million Orthodox Christians, said altering the status of Hagia Sophia would fracture Eastern and Western worlds. Russia's Orthodox church said turning it into a mosque was unacceptable.
- U.S. Secretary of State Mike Pompeo said any change would diminish its ability "to serve humanity as a much-needed bridge between those of differing faith traditions and cultures".
- Neighbouring Greece, an overwhelmingly Orthodox country, said Turkey risked opening up a "huge emotional chasm" with Christian countries if it converts a building which was central to the Greek-speaking Byzantine empire and Orthodox church.
- Turkey has criticised what it says is foreign interference. "This is a matter of national sovereignty," Turkish Foreign Minister Mevlut Cavusoglu said. "What is important is what the Turkish people want."