This church was built in 527, a few years before the Hagia Sophia, under the reign of Emperor Justinian and Empress Theodora. It was dedicated to Saints Sergius and Bacchus, two Roman centurions who converted to Christianity and were martyred because of their faith. It is said that when the emperor Justinian was implicated in a plot to kill his uncle (Justin I), the two saints appeared to Justin in a dream and told him that Justinian was innocent. It was converted to a mosque after the conquest of Istanbul by the Ottomans in 1453. Turks today also call it "Kuçuk Aya Sofya", or "Little Haghia Sophia."