Eight huge medallions, bearing the Arabic names of Allah, Mohammed, two of his grandsons, and the first four caliphs, and a quotation from the Koran in the crown of the dome, are remnants of Haghia Sophia's 500 years of service as an imperial mosque, as are the elaborate mihrab and mimber in the apse.
Haghia Sophia was an imperial mosque for five hundred years.