 Between 1486 and 1491 "Kapicibaşi" (and later Grand Vizier) Koca Mustafa Pasha, executed in 1512, converted the church into a mosque.Some years later, the building of the monastery was endowed by his son-in-law, Şeih Çelebi Efendi as Tekke for the Dervishes of the "Halveti" order.The dervishes were led at that time by the Sufi Master Sünbül Efendi.