0309 GMT September 19, 2020
Turkey's President Recep Tayyip Erdogan announced the decision after a court annulled the site's museum status, BBC reported.
Built 1,500 years ago as an Orthodox Christian cathedral, Hagia Sophia was converted into a mosque after the Ottoman conquest in 1453.
In 1934 it became a museum and is now a UNESCO World Heritage site.
Defending the decision, President Erdogan stressed that the country had exercised its sovereign right in converting it back to a mosque.
He told a press conference the first Muslim prayers would be held inside the building on July 24.
"Like all our mosques, the doors of Hagia Sophia will be wide open to locals and foreigners, Muslims and non-Muslims," he added.
A change is coming to Hagia Sophia, which has endured since the 6th century, outlasting the Byzantine Empire and the Ottoman era. Now, once again, it will be a mosque. But Turkish officials say Christian emblems, including mosaics of the Virgin Mary which adorn its soaring golden dome, will not be removed.
Making changes at Hagia Sophia is profoundly symbolic. It was Kemal Ataturk who decreed that it should be a museum.
The Turkish leader is making no apologies for the change. He said anyone who doesn't like it — and plenty abroad don't — is attacking Turkey's sovereignty.
Shortly after the announcement, the first call to prayer was recited at Hagia Sophia and was broadcast on all of Turkey's main news channels. The cultural site's social media channels have now been taken down.
The Council of State, Turkey's top administrative court, said in its ruling on Friday: "It was concluded that the settlement deed allocated it as a mosque and its use outside this character is not possible legally."
"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.