US Secretary of State Mike Pompeo on Wednesday urged Turkish President Recep Tayyip Erdogan not to convert the Hagia Sophia into a mosque and said Istanbul's celebrated former cathedral should remain open to all.

Erdogan, whose roots are in political Islam, has mused about turning Hagia Sophia back into a mosque, triggering tension with neighboring Greece.

Pompeo issued a statement on the eve of an expected Turkish court decision on whether Hagia Sophia was rightfully turned into a museum.

"We urge the government of Turkey to continue to maintain the Hagia Sophia as a museum, as an exemplar of its commitment to respect the faith traditions and diverse history that contributed to the Republic of Turkey, and to ensure it remains accessible to all," Pompeo said.

"The United States views a change in the status of the Hagia Sophia as diminishing the legacy of this remarkable building and its unsurpassed ability -- so rare in the modern world -- to serve humanity as a much-needed bridge between those of differing faith traditions and cultures," he said in a statement.

Turkey said it was "stupefied" by Pompeo's remarks.

"Everyone is free to express their opinion," said foreign ministry spokesman Hami Aksoy.

"At the same time, no one has the right to speak about our sovereign rights in the form of a warning," he said.

The United States has urged Turkey not to change the status of the Hagia Sophia, a church turned mosque turned museum
The United States has urged Turkey not to change the status of the Hagia Sophia, a church turned mosque turned museum AFP / Ozan KOSE

Pompeo -- an evangelical Protestant who often speaks about the rights of religious minorities -- said that the United States hoped to maintain dialogue with Turkey over the preservation of religious and cultural sites.

Muslim clerics in May recited prayers inside the landmark to celebrate the anniversary of the Ottomans' 1453 conquest of the city, then known as Constantinople.

The stunning edifice was first built as a church in the sixth century under the Byzantine Empire as the centerpiece of Constantinople.

After the Ottoman conquest, it was converted into a mosque before being turned into a museum during the rule of Mustafa Kemal Ataturk, the secularizing founder of modern Turkey, in the 1930s.

Erdogan mused last year about turning the museum back into a mosque.

The remarks have drawn wide concern in Greece, whose Orthodox Church maintains its ecumenical patriarchate in Istanbul.

Turkey is a NATO ally of the United States but the two nations have seen friction in recent years, including over Ankara's incursions into Syria and its purchase of weapons from Russia.