Post the Greek emperor got defeated by the Ottoman Turks, Hagia Sophia was turned into a mosque in the 15th century.