Before Emperor Justinian constructed the Aya Sofya, he needed to try out if the building would work fundamentally so he manufactured this smaller than usual form first. Its original name was the Church of Sergius and Bacchus, but the obvious architectural parallels with the Aya Sofya led to its long-held nickname becoming the building's official title.
Amid the Ottoman period, the Church was changed over into a mosque regardless it works as a working mosque today. Although its proportions aren't as grandiose as others in Istanbul, the building has been beautifully restored and is well worth a visit. The stroll here, down thin rear ways fixed with tall Ottoman period structures - some sumptuously reestablished and others squeaking their way into decrepitude - is a quiet relief from focal Sultanahmet.