Thousands of Turks gathered near Hagia Sophia early on Friday for the first prayers there since President Tayyip Erdogan declared the monument, revered by Christians and Muslims for almost 1,500 years, a mosque once again.
Crowds formed at checkpoints surrounding the historic heart of Istanbul, where thousands of police maintained security. On entering the secured area the worshippers, wearing face masks sat spaced out on prayer mats in the city's Sultanahmet Square.
"We are ending our 86 years of longing today," said one man Sait Colak, referring to the nearly nine decades since Hagia Sophia was declared a museum and ceased to be a place of worship. "Thanks to our president and the court decision today we are going to have our Friday prayers in Hagia Sophia."
A top Turkish court announced this month it annulled Hagia Sophia's status as a museum. Erdogan immediately turned back into a mosque a building which was a Christian Byzantine cathedral for 900 years before being seized by Ottoman conquerors and serving as a mosque until 1934.
The president was scheduled to attend Friday prayers shortly after 1 pm (1000 GMT) along with several hundred invitees for the ceremony in the sixth-century building.
During his 17-year rule, Erdogan has championed Islam and religious observance and backed efforts to restore Hagia Sophia's mosque status. He said Muslims should be able to pray there again and raised the issue - popular with many pious AKP-voting Turks - during local elections last year.
The conversion triggered fierce criticism from church leaders, who said the conversion to exclusively Muslim worship risked deepening religious divisions. Turkey says the site will remain open for visitors and its Christian artworks protected.
Erdogan has reshaped Turkey's modern republic, established nearly a century ago by the staunchly secularist Mustafa Kemal Ataturk, lifting a ban on Muslim headscarves in public, promoting religious education and taming Turkey's powerful military, once a bastion of Ataturk's secular values.
Inside Hagia Sophia, the Christian frescoes and the glittering mosaics adorning the cavernous dome and central hall will be concealed by curtains during Muslim prayer times, but remain on display for the rest of the time.
On Friday morning, the interior echoed to the sound of Koranic recitations from white-robed clerics, sat on blue carpets freshly laid this week ahead of the prayers.