Turkey’s highest administrative court has issued a ruling paving the way for the Hagia Sophia in Istanbul to be converted back into a Muslim house of worship.

The Council of State threw its weight behind a petition brought by a religious group.

It annulled a 1934 Cabinet decision that changed the sixth century building, which was once a cathedral, into a museum.

The ruling allows the Turkish Government to restore the Hagia Sophia’s previous status as a mosque.

Turkey Hagia SofiaHagia Sophia is one of Istanbul’s main tourist attractions (Emrah Gurel/AP)

Dozens of people who awaited the court’s ruling outside the Hagia Sophia jubilantly chanted “Allah is great!” when the news came out.

The decision is in line with the Turkish president’s calls to turn the hugely symbolic world heritage site into a mosque despite widespread international criticism, including from the US and Orthodox Christian leaders.

It could deepen tensions with neighbouring Greece, which also called on Turkey to maintain the structure’s status as a museum.

The religious group had contested the legality of the 1934 decision by the modern Turkish republic’s secular Government ministers and argued the building was the personal property of Ottoman Sultan Mehmet II, who conquered Istanbul in 1453.

The court ruled Hagia Sophia is the property of a foundation managing the Sultan’s assets and has opened it up to the public as a mosque.