Crowds gathered in Istanbul as the historic Hagia Sophia site opened for Friday prayers for the first time since Turkish authorities ruled it could be converted into a mosque.
Clerics in white robes sang from the Koran. Mosaics and frescoes of Jesus and Mary were draped with curtains.
The 1500-year-old Unesco World Heritage site became a museum in 1934.
This month a Turkish court annulled its status, saying any use other than as a mosque was "not possible legally".
The decision to turn it back into a mosque was criticised by religious and political leaders worldwide.
But President Recep Tayyip Erdogan responded quickly to the ruling, vowing that the world-famous site would be ready for Friday prayers from 24 July, and he was seen joining worshippers at around midday.
About 1000 people were allowed in through security checkpoints, while others laid out prayer mats outside. An opening ceremony was followed by a formal prayer service and proceedings were relayed outside on a big screen. Four muezzin recited the call to prayer from each of the four minarets.
Hagia Sophia was built as an Orthodox Christian cathedral and first converted into a mosque after the Ottoman conquest nine centuries later.
While there was considerable excitement as crowds headed to the Unesco site, not everyone was happy. The secular opposition party that runs Istanbul has described the move to turn it back into a mosque after 86 years as political rather than religious.
In neighbouring Greece, which was marking the anniversary of the restoration of democracy in 1974, Prime Minister Kyriakos Mitsotakis conveyed a message of sorrow to millions of Greek Orthodox Christians. Hagia Sophia's change of status by Turkey was not a show of power, but evidence of weakness, he declared.
Appeal for patience
Governor Yerlikaya had urged those attending prayers on Friday to bring "[face] masks, a prayer rug, patience and understanding" to help prevent the spread of Covid-19.
As crowds grew, he appealed for patience.
During a sermon, Turkey's religious affairs agency president, Ali Erbas, held up a sword in an apparent reference to Ottoman traditions. "Sultan Mehmet the Conqueror dedicated this magnificent construction to believers to remain a mosque until the Day of Resurrection," he said, referring to the emperor who conquered Istanbul in the 15th century.
Erdogan's move considered controversial
Islamist groups and devout Muslims in Turkey had long called for Hagia Sophia to become a mosque again, but secular opposition members opposed the move.
When President Erdogan announced the decision on 10 July, it was met with widespread criticism.
Pope Francis responded by saying that his "thoughts go to Istanbul", adding: "I think of Santa Sophia and I am very pained."
The head of the Eastern Orthodox Church, Patriarch Bartholomew I, warned that the conversion of the building would "disappoint millions of Christians" and fracture two worlds.
The World Council of Churches, a worldwide Christian organisation, warned the decision would sow division.
Unesco said it regretted the move, which further enflamed tensions with neighbouring Greece, home to millions of Orthodox followers.
But Erdogan stressed that the country had exercised its sovereign right.
"After 86 years, Hagia Sophia will serve as a mosque again, in the way Fatih the conqueror of Istanbul had indicated in his deed," he said.
He added that the building would remain open to all Muslims, non-Muslims and foreign visitors.
Many Turks were sceptical. A former Erdogan ally, Ali Babacan, said Hagia Sophia had "come to the agenda now only to cover up other problems".
Novelist Orhan Pamuk told the BBC earlier this month that converting it back to a mosque was a statement to the world that Turks did not want to be secular any more, even though millions of Turks had been happy with its status as a museum.
The head of the secular Republican People's Party (CHP), Kemal Kilicdaroglu, said that all the president was concerned with was domestic politics. And a July opinion poll suggested 43 percent of Turks saw the move as a way of avoiding discussion of the country's economic difficulties.
The history
The iconic, domed building sits in Istanbul's Fatih district, on the west bank of the Bosporus, overlooking the Golden Horn harbour.
Hagia Sophia's complex history began almost 1500 years ago, when Byzantine emperor Justinian built the huge church in the year 537.
In 1453, in a devastating blow to the Byzantines, Ottoman Sultan Mehmet II captured Istanbul (formerly known as Constantinople) and Hagia Sophia - an Orthodox Christian cathedral - was converted into a mosque for Friday prayers.
Four minarets were added to the exterior, while ornate Christian icons and gold mosaics were covered with panels of Arabic religious calligraphy.
After centuries at the heart of the Muslim Ottoman empire, it was turned into a museum in 1934 in a drive to make Turkey more secular.
It has since become one of its most popular tourist sites, receiving more than 3.7 million visitors last year.
Although it has had a small prayer room since 1991, and calls to the faithful have been heard before, Friday's event is the first mass prayers inside the site since the 1930s.
- BBC