Excerpts from Books and Wikipedia
After the riots of January 532 and the burning of the old basilica, Justinian ordered the building of a new basilica, which was to become Hagia Sophia. Hagia Sophia was stripped of its treasures during the Fourth Crusade of 1204. When the Ottoman Turks conquered Constantinople, Hagia Sophia was converted into a mosque with four minarets added. [Furtado: 1001 Days]