After the death of his wife, shortly after 1124, Emperor John II Komnenos built another church to the north of the first dedicated to the Theotokos Eleousa ("the merciful"), and finally (the terminus ante quem is 1136) connected the two shrines with a chapel (dedicated to Saint Michael), which became the imperial mausoleum (heroon) of the Komnenos and Palaiologos dynasties. Besides many Byzantine dignitaries, Emperor John II and his wife Eirene, Empress Bertha of Sulzbach (also known as Eirene, and wife of Manuel I Komnenos), and Emperor John V Palaiologos were buried here.
During the Latin domination after the Fourth Crusade, the complex was the see of the Venetian clergy, and the icon of the Theotokos Hodegetria was housed here. The monastery was also used as an imperial palace by the last Latin Emperor, Baldwin. After the Palaiologan restoration the monastery was used again by Orthodox monks. The most famous among them was Gennadius II Scholarius, who left the Pantokrator to become the first Patriarch of Constantinople after the Islamic conquest of the city.
Shortly after the Fall of Constantinople the building was converted into a mosque, and the monastery was converted for a while into a Medrese. The Ottomans named it after Molla Zeyrek, a scholar who was teaching there. However, due to its importance in Byzantine history, Zeyrek was one among the few buildings of Istanbul whose ancient denomination was never forgotten. Among others, the church of Pantokrator is remembered by Pierre Gilles in his classic work about Constantinople, written in the sixteenth century. The rooms of the monastery occupied by the Medrese vanished later.
Until a few years ago, the edifice was in a desolate state, and as a result it was added to the UNESCO watchlist of endangered monuments. During the recent years it underwent extensive (albeit still unfinished) restoration.
Today Zeyrek Mosque is - after Hagia Sophia - the second largest extant religious edifice built by the Byzantines in Istanbul.
To the East lies the Ottoman Konak (Zeyrek Hane), which has also been restored and is now open as a restaurant and tea garden.

