It was transformed into a museum in 1934 by Mustafa Kemal Ataturk, the secularizing founder of the Turkish republic.
Turkish President Recep Tayyip Erdogan sat front and center, removing a white face mask to recite passages from the Quran as he sat on a blue carpet. It was the greatest dream of our youth.
A Turkish court decision has paved the way for Istanbul's ancient Hagia Sophia to be converted from a museum back into a mosque.
Only about 1,000 people are being allowed inside at any one time because of the coronavirus.
The sixth century UNESCO-listed site was initially an Orthodox Christian cathedral that became a mosque following the Ottoman conquest of Istanbul in 1453.
Brushing aside global criticism, Erdogan issued a decree restoring the iconic building as a mosque earlier this month, shortly after a Turkish high court ruled that Hagia Sophia had been illegally made into a museum more than eight decades ago.
Pope Francis himself expressed his sadness at the decision. A large media contingent was on hand, complete with satellite trucks and a scaffolding set up to give TV live positions a view of the Hagia Sophia.
He also described its conversion into a museum by the republic's founding leaders as a mistake that is being rectified.
In neighboring Greece, bells tolled and flags flew at half staff at hundreds of churches across the country in protest.
Greek government spokesman Stelios Petsas said that this is a hard day and that "shadows hung over us" by turning Hagia Sophia into a mosque.
"We have warned for some time that this will create an unbridgeable gap between Turkey and the Christian world".
Perhaps the most significant worldwide criticism of the move is coming from Greece, where a large number of Orthodox Christians live, and the Greek community.
Turkish officials have emphasized that when it is not being used as a mosque, the Hagia Sophia - which is popular with tourists visiting Istanbul - will be open to all to visit free of charge, according to state-run news agency Anadolu.
The Turkish government has tried to reassure skeptics that the building's Christian artworks and frescoes will not be touched, with technology instead being used to hide them during Friday prayers. Prayer mats were laid out in Sultanahmet Square as the call to prayer rang out.
Speaking to Anadolu Agency in Brussels, Suleyman Murtaza said that opening Hagia Sophia for worship is a very important development for the Muslim world. Archbishop Elpidophoros of America held a meeting with President Trump and Vice President Mike Pence in Washington on Thursday to discuss concerns over the re-conversion.