Justinian and his wife Theodora built this little church sometime between 527 and 536, just before Justinian built Aya Sofya. You can still see their monogram worked into some of the frilly white capitals. The building is one of the most beautiful Byzantine structures in the city despite being converted into a mosque in the early 16th century and having many of its original features obscured during an extensive restoration in 2007.
Named after Sergius and Bacchus, the two patron saints of Christians in the Roman army, the building has been known as Little (Küçük in Turkish) Aya Sofya for much of its existence. Its dome is architecturally noteworthy and its plan – an irregular octagon – is quite unusual. Its interior was originally decorated with gold mosaics and featured columns made from fine green and red marble. The mosaics are long gone, but the impressive columns remain. The church was converted into a mosque by the chief white eunuch Hüseyin Ağa around 1500; his tomb is to the north of the building. The minaret and medrese (seminary) date from this time.
The medrese cells, arranged around the mosque's forecourt, are now used by secondhand booksellers and bookbinders. In the leafy forecourt is a tranquil çay bahçesi (tea garden) where you can relax over a glass of çay.