The Küçük Ayasofya Mosque was originally constructed as a church located between the Cankurtaran and Kadırga Neighborhoods of the Eminönü District by the Byzantine Emperor Justinian I (527-565). The mosque, built in the year 530 CE, called the Church of Sts. Sergius and Bacchus, was converted into a mosque during the reign of Sultan Bayezit II after the conquest of Istanbul by Darüssaade Ağası (overseer of the sultan’s harem), Hüseyin Ağa. After its convertion into a mosque, the zaviye (cell for meditation) around the atrium and Hüseyin Ağa’s tomb were built.