Fulfilling a dream of his Islamic-oriented youth, Turkish President Recep Tayyip Erdogan joined hundreds of worshipers Friday for the first Muslim prayers in 86 years inside Hagia Sophia, the Istanbul landmark that served as one of Christendom’s most significant cathedrals, a mosque and a museum before its conversion back into a Muslim place of worship.

Thousands of other Muslim faithful came from across Turkey and quickly filled specially designated areas outside of the Byzantine era monument to join in the inaugural prayers. Many others were turned away, while Orthodox Christian church leaders in Greece and the United States announced a “day of mourning” over Hagia Sophia’s return as a mosque.

Hagia Sophia

The prayers began with Erdogan reciting from the Quran. The head of Turkey’s religious authority, Ali Erbas, led the ceremony and prayed that Muslims would never again be “denied” the right to worship at the internationally celebrated 6th century structure.

As many as many as 350,000 people took part in Friday’s prayers, the president said.

Adem Yilmaz, who attended the prayers, expressed joy at experiencing “the making of history.”

“This turned into a place where all hearts beat at once,” he said.

Brushing aside international criticism, Erdogan issued a decree restoring the iconic building as a mosque earlier this month, shortly after a Turkish high court ruled that the Hagia Sophia had been illegally made into a museum more than eight decades ago.

The structure, a UNESCO World Heritage site, has since been renamed “The Grand Hagia Sophia Mosque.”

The move sparked dismay in Greece, the United States and among Christian church leaders who had called on Erdogan to maintain Hagia Sophia as a museum in recognition of Istanbul’s multi-faith heritage and the structure’s status as a symbol of Christian and Muslim unity.

The reopening of Hagia Sophia as a mosque threatens to deepen Turkey’s isolation on the world stage following its military interventions in Syria and Iraq and amid international disputes over oil-and-gas rights in the eastern Mediterranean Sea.

The decision was in line with Erdogan’s ambitions to raise Islam’s profile in Turkey and to make his country a leader nation in the Islamic world.

Hagia Sophia’s reemergence as a mosque is also being interpreted as a move aimed at consolidating Erdogan’s conservative and religious support base at a time when his popularity is sagging amid an economic downturn.

“It allows him to switch the narrative away from the economy to the culture wars, an area where he did well in the past by mobilizing his right-wing base,” said Soner Cagaptay, Turkey analyst for the Washington Institute and author of “Erdogan’s Empire.”

By transforming Hagia Sophia back into a mosque. Erdogan may also be seeking to leave “his permanent imprint” on Istanbul – the city of his birth and where he served as mayor, Cagaptay added.

Built by the Byzantine Emperor Justinian in 537, Hagia Sophia was turned into a mosque with the 1453 Ottoman conquest of Istanbul. Mustafa Kemal Ataturk, the founding leader of the secular Turkish republic converted the structure into a museum in 1934.

Although an annex to the Hagia Sophia, the Sultan’s pavilion, has been open to prayers since the 1990s, religious and nationalist groups in Turkey have long yearned for the nearly 1,500-year-old edifice they regard as the legacy of Ottoman Sultan Mehmet the Conquerer, to be reverted into a mosque.

“This is Hagia Sophia breaking away from its captivity chains. It was the greatest dream of our youth,” Erdogan said last week. “It was the yearning of our people and it has been accomplished.” Erdogan also described its conversion into a museum by the republic’s founding leaders as a mistake that is being rectified.

In neighboring Greece, bells tolled and flags flew at half-staff at hundreds of churches across the country in protest at the decision to turn Hagia Sophia into a mosque. The Greek Orthodox Church leader, Archbishiop Ieronymos, held a special service at Athens Cathedral later Friday. Churches in Athens and in Greece’s second-largest city, Thessaloniki, also organized vigils.

“Universal values have been tarnished, and that is why they require universal condemnation,” Greek Prime Minister Kyriakos Mitsotakis said.

A few hundred people took part in two peaceful protests in Athens. After the services in Thessaloniki, dozens tried to hold a protest march to the Turkish Consulate, but police prevented the crowd from reaching the building. They burned two Turkish flags before dispersing.

Greek President Katerina Sakellaropoulou said the reconversion “brutally insults not only the Orthodox but all Christians, and also all of civilized humanity.”

The history and religious traditions of the predominantly Greek-speaking and Orthodox Christian Byzantine Empire remain influential in Greece. The church protests also occurred amid a volatile dispute between Greece and Turkey over mineral rights in the eastern Mediterranean, with the Greek military on alert over a planned Turkish maritime survey in waters claimed by Greece.

In New York, the Greek Orthodox Archdiocese of America, called the inaugural prayers a “cultural and spiritual misappropriation and a violation of all standards of religious harmony and mutual respect.” Archbishop Elpidophoros of America held a meeting with U.S. President Donald Trump and Vice President Mike Pence in Washington on Thursday to discuss concerns over the reconversion.

In his sermon, Erbas said Mehmet the Conqueror had endowed Hagia Sophia “to believers on condition that it should remain a mosque until the last day.

“Any property that is endowed is inviolable in our belief and burns whoever touches it,” Erbas said.

Hundreds had camped near the structure overnight. Dozens of worshipers broke through one police checkpoint to rush toward Hagia Sophia and social distancing practices, in place due to the coronavirus outbreak, were being ignored, Turkish media reported.

Retired teacher Suleyman Karatas said: “God willing, it will stay as a mosque. Because Hagia Sophia is the legacy of our ancestor.”

Turkey has vowed to protect Hagia Sophia’s artifacts and has said it will remain open to visits by Muslims and non-Muslims outside of prayer hours.