Erdogan's comments come after a top Turkish administrative court annulled the 1934 conversion of Hagia Sophia into a museum.
Turkish President Recep Tayyip Erdogan said the first Muslim prayers at Istanbul's famed Hagia Sophia would be performed on July 24 after a top court annulled its museum status on Friday.
"God willing, we will perform Friday prayers all together on July 24 and reopen Hagia Sophia to worship," Erdogan said in an address to the nation.
"Like all our mosques, the doors of Hagia Sophia will be wide open to locals and foreigners, Muslims and non-Muslims."
The Council of State, Turkey's highest administrative court, on Friday unanimously revoked a 1934 cabinet decision making it a museum.
Erdogan then swiftly handed over the administration of the Hagia Sophia Mosque to the religious affairs directorate to reopen it for Muslim worship.
The stunning edifice was first built in the sixth century as a Christian church under the Byzantine Empire as the centrepiece of Constantinople.
After the Ottoman conquest in 1453, it was converted into a mosque before being turned into a museum during the rule of Mustafa Kemal Ataturk, the founder of modern Turkey, in the 1930s.
In a televised address to the nation, Erdogan assured that the Hagia Sophia would be open to non-Muslim visitors.
"Hagia Sophia, the common heritage of the humanity, will continue to embrace everyone in a more sincere and more free spirit with its new status," he said.
The Turkish leader urged everyone to "respect" Turkey's decision.
"The issue of what purposes Hagia Sophia will be used for concerns Turkey's sovereign rights," he said, adding that his government would consider any criticism as a "violation of our independence."
READ MORE: Hagia Sophia, what happens now?
Bipartisan support for decision
Turkish Grand National Assembly showed a bipartisan support for the President Erdogan's decree opening Istanbul's Hagia Sophia for prayers.
Parliamentarians from different political parties cheered by applauding the decision while the acting speaker Celal Adnan was reading it.
The Turkish parliament speaker on different podium said Hagia Sophia's turning into a mosque ended a longing for a generation.
"With Hagia Sophia decision, a longing in the heart of our nation has ended," Mustafa Sentop told the reporters in the parliament.
Sentop said Hagia Sophia's turning into a mosque was "a dream and goal" for his generation.
Reaction to court ruling
There was jubilation outside the terracotta-hued structure with its cascading domes and four minarets.
Dozens of people awaiting the court’s ruling chanted “Allah is great!” when the news broke. A large crowd later prayed outside it.
In the capital of Ankara, legislators stood and applauded as the decision was read in Parliament.
Erdogan had spoken in favour of opening the hugely symbolic UNESCO World Heritage site for worship despite international criticism, including from US and Orthodox Christian leaders, who had urged Turkey to keep its status as a museum.
Greece's culture ministry claimed that the verdict was an "open provocation" to the civilised world.
A Greek Cypriot official Nikos Christodoulides posted on his official Twitter account that Greek Cypriot administration “strongly condemns Turkey’s actions on Hagia Sophia.”
The Russian Orthodox Church expressed dismay at the decision to revoke the museum status of the iconic Hagia Sophia.