quality:correction, linguistic:voice_change
Reversion to mosque (2018–present)

Since 2018, Turkish president Recep Tayyip Erdoğan had talked of reverting the status of the Hagia Sophia back to a mosque, a move seen to be very popularly accepted by the religious populace whom Erdoğan was attempting to persuade. On 31 March 2018 Erdoğan recited the first verse of the Quran in the Hagia Sophia, dedicating the prayer to the "souls of all who left us this work as inheritance, especially Istanbul's conqueror," strengthening the political movement to make the Hagia Sophia a mosque once again, which would reverse Atatürk's measure of turning the Hagia Sophia into a secular museum. In March 2019 Erdoğan said that he would change the status of Hagia Sophia from a museum to a mosque, adding that it had been a "very big mistake" to turn it into a museum. As a UNESCO World Heritage site, this change would require approval from UNESCO's World Heritage Committee. In late 2019 Erdoğan's office took over the administration and upkeep of the nearby Topkapı Palace Museum, transferring responsibility for the site from the Ministry of Culture and Tourism by presidential decree.

In 2020, Turkey's government celebrated the 567th anniversary of the Conquest of Constantinople with an Islamic prayer in Hagia Sophia. Erdoğan said during a televised broadcast " Al-Fath surah will be recited and prayers will be done at Hagia Sophia as part of conquest festival". In May, during the anniversary events, passages from the Quran were read in the Hagia Sophia. Greece condemned this action, while Turkey in response accused Greece of making "futile and ineffective statements". In June, the head of Turkey's Directorate of Religious Affairs (Diyanet) said that "we would be very happy to open Hagia Sophia for worship" and that if it happened "we will provide our religious services as we do in all our mosques". On 25 June, John Haldon, president of the International Association of Byzantine Studies, wrote an open letter to Erdoğan asking that he "consider the value of keeping the Aya Sofya as a museum".

On 10 July 2020, the decision of the Council of Ministers from 1935 to transform the Hagia Sophia into a museum was annulled by the Council of State, decreeing that Hagia Sophia cannot be used "for any other purpose" than being a mosque and that the Hagia Sophia was property of the Fatih Sultan Mehmet Han Foundation. The council reasoned Ottoman Sultan Mehmet II, who conquered Istanbul, deemed the property to be used by the public as a mosque without any fees and was not within the jurisdiction of the Parliament or a ministry council. Despite secular and global criticism, Erdoğan signed a decree annulling the Hagia Sophia's museum status, reverting it to a mosque. The call to prayer was broadcast from the minarets shortly after the announcement of the change and rebroadcast by major Turkish news networks. The Hagia Sophia Museum's social media channels were taken down the same day, with Erdoğan announcing at a press conference that prayers themselves would be held there from 24 July. A presidential spokesperson said it would become a working mosque, open to anyone similar to the Parisian churches Sacré-Cœur and Notre-Dame. The spokesperson also said that the change would not affect the status of the Hagia Sophia as a UNESCO World Heritage site, and that "Christian icons " within it would continue to be protected. Earlier the same day, before the final decision, the Turkish Finance and Treasury Minister Berat Albayrak and the Justice Minister Abdulhamit Gül expressed their expectations of opening the Hagia Sophia to worship for Muslims. Mustafa Şentop, Speaker of Turkey's Grand National Assembly, said "a longing in the heart of our nation has ended". A presidential spokesperson claimed that all political parties in Turkey supported Erdoğan's decision; however, the Peoples' Democratic Party had previously released a statement denouncing the decision, saying "decisions on human heritage cannot be made on the basis of political games played by the government". The mayor of Istanbul, Ekrem İmamoğlu, said that he supports the conversion "as long as it benefits Turkey", adding that he felt that Hagia Sophia has been a mosque since 1453. Ali Babacan attacked the policy of his former ally Erdoğan, saying the Hagia Sophia issue "has come to the agenda now only to cover up other problems". Orhan Pamuk, Turkish novelist and Nobel laureate, publicly denounced the move, saying "Kemal Atatürk changed... Hagia Sophia from a mosque to a museum, honouring all previous Greek Orthodox and Latin Catholic history, making it as a sign of Turkish modern secularism".

On 17 July, Erdoğan announced that the first prayers in the Hagia Sophia would be open to between 1,000 and 1,500 worshippers. He said that Turkey had sovereign power over Hagia Sophia and was not obligated to bend to international opinion.

While the Hagia Sophia has now been rehallowed as a mosque, the place remains open for visitors outside of prayer times. While at the beginning the entrance was free, later the Turkish government decided that, starting from 15 January 2024, the foreign nationals will have to pay an entrance fee.

On 22 July, a turquoise-coloured carpet was laid to prepare the mosque for worshippers; Ali Erbaş, head of the Diyanet, attended its laying. The omphalion was left exposed. Due to the COVID-19 pandemic, Erbaş said Hagia Sophia would accommodate up to 1,000 worshippers at a time and asked that they bring " masks, a prayer rug, patience and understanding". The mosque opened for Friday prayers on 24 July, the 97th anniversary of the signature of the Treaty of Lausanne, which established the borders of the modern Turkish Republic. The mosaics of the Virgin and Child in the apse were covered by white drapes. There had been proposals to conceal the mosaics with lasers during prayer times, but this idea was ultimately shelved. Erbaş proclaimed during his sermon, "Sultan Mehmet the Conqueror dedicated this magnificent construction to believers to remain a mosque until the Day of Resurrection ". Erdoğan and some government ministers attended the midday prayers as many worshippers prayed outside; at one point the security cordon was breached and dozens of people broke through police lines. Turkey invited foreign leaders and officials, including Pope Francis, for the prayers. It is the fourth Byzantine church converted from museum to a mosque during Erdoğan's rule.

In April 2022, the Hagia Sophia held its first Ramadan tarawih prayer in 88 years.