This church was built in 1292 by John Comnenus, probably related to the royal family, and his wife Anna Doukaina. Later additions and renovations were made, including the construction of a side chapel in 1315 to house the remains of Michael Glabas, a former general, and his family. In 1456 the Orthodox Patriarchate moved here from the Havariyun and remained here until 1586. Five years later, Murat III converted the church into a mosque and renamed it in honor of his conquest over Georgia and Azerbaijan. To accommodate a larger inner space for prayer, most of the interior walls were removed.

The interior of the church/mosque contains the best mosaic panels after the Ayasofya and St. Savior in Chora. In the dome is a representation of the Pantocrator surrounded by prophets (Moses, Jeremiah, Zephaniah, Micah, Joel, Zechariah, Obadiah, Habakkuk, Jonah, Malachi, Ezekiel, and Isaia). In the apse Christ Hyperagathos is shown with the Virgin and St. John the Baptist. The Baptism of Christ survives intact to the right of the dome.