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 thoroughly 'mosque-ified' during a recent restoration.
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. Like Aya Sofya, 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 date from this time.
The medrese cells, arranged around the mosque's forecourt, are now used by second-hand booksellers and bookbinders. In the leafy forecourt there is a tranquil çay bahçesi where you can relax over a glass of tea.