Friday prayers are being held at the Hagia Sophia mosque in Istanbul for the first time since it was turned into a museum 85 years ago.
Only about 1,000 people are being allowed inside at any one time because of the coronavirus.
Turkish President Recep Tayyip Erdogan was among the worshippers.
A large screen and speakers were set up outside to broadcast proceedings to the large crowds gathered outside. The Governor of Instanbul ordered the mosque remain open until Saturday to allow worshippers to complete their prayers.
Clerics in white robes sang from the Koran. Mosaics and frescoes of Jesus and Mary were draped with curtains.
The 1,500-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 (09:00 GMT).
About 1,000 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.
Outside Hagia Sophia
By Neyran Elden, BBC Turkish
Tens of thousands of men and women waited for the call to prayer – many had travelled from cities across Turkey.
Worshippers took their places on the grass or on the pavement. The lucky ones found shade under a tree.
Security was tight across the historic peninsula of Istanbul, and at one point dozens of worshippers broke through a police checkpoint. A group of men waved Turkish flags and chanted “Allahu Akbar” (God is greatest).
While a significant section of Turkish society has criticised the change to a mosque, the emotion and enthusiasm outside it was palpable. A 45-year-old woman said she had always liked Hagia Sophia as a museum, but “always thought it was a cold building”.
Now was the moment for Turkey to reinforce its independence, she added. “We have been waiting for this moment since our childhood.”
What was it like inside?
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.
A turquoise carpet had been laid on the floor to prepare for prayers and Christian relics were covered up with white drapes or obscured by lighting.
This image of the interior of the Hagia Sophia was posted on Twitter early on Friday by the governor of Istanbul
Scaffolding was erected inside the dome as builders scrambled to convert the interior of the ancient building. By Friday the scaffolding was largely covered by red panelling.
The former Byzantine Cathedral is renowned for its large mosaics depicting Jesus and the Virgin Mary. Among the Christian mosaics covered over on Friday was the Ninth-Century mosaic of the Virgin Mary and Jesus inside the apse.
Why was Erdogan’s move 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 Mr 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% of Turks saw the move as a way of avoiding discussion of the country’s economic difficulties.
What’s 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 1,500 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