Erdogan made his announcement just an hour after the court ruling was revealed, despite international warnings not to change the status of the nearly 1,500-year-old monument, revered by Christians and Muslims alike.
“The decision was taken to hand over the management of the Ayasofya Mosque […] to the Religious Affairs Directorate and open it for worship,” the decision signed by Erdogan said.
Erdogan had earlier proposed restoring the mosque status of the Unesco World Heritage Site, a focal point of both the Christian Byzantine and Muslim Ottoman empires and now one of the most visited monuments in Turkey.
The United States, Greece and church leaders were among those to express concern about changing the status of the huge sixth-century building, converted into a museum in the early days of the modern secular Turkish state under Mustafa Kemal Ataturk.
“It was concluded that the settlement deed allocated it as a mosque and its use outside this character is not possible legally,” the Council of State, Turkey’s top administrative court in Ankara, said in its ruling.
“The cabinet decision in 1934 that ended its use as a mosque and defined it as a museum did not comply with laws,” it said, referring to an edict signed by Ataturk.
Russian Orthodox Church expresses regret
The association which brought the court case, the latest in a 16-year legal battle, said Hagia Sophia was the property of the Ottoman leader who captured the city in 1453 and turned the already 900-year-old Byzantine church into a mosque.
Erdogan, a pious Muslim, threw his weight behind the campaign to convert the building before local elections last year.
The Ottomans built minarets alongside the vast domed structure, while inside they added huge calligraphic panels bearing the Arabic names of the early Muslim caliphs alongside the monument’s ancient Christian iconography.
The Russian Orthodox Church said it regretted that the court did not take its concerns into account when making its ruling and said the decision could lead to even greater divisions, the TASS news agency reported.
Previously, Ecumenical Patriarch Bartholomew, the spiritual head of some 300 million Orthodox Christians worldwide and based in Istanbul, said converting it into a mosque would disappoint Christians and would “fracture” East and West.
US State Secretary Mike Pompeo and Greece had also urged Turkey to maintain the building as a museum.
But Turkish groups have long campaigned for Hagia Sophia’s conversion into a mosque, saying this would better reflect Turkey’s status as an overwhelmingly Muslim country.