The area of the mosque was a khanqah of Rufai order which was built by Muhammad Maarifi since 1818. The khanqah was damaged during the 1894 Istanbul earthquake but was soon restored. The 1925 religious reforms banned khanqahs in Turkey, and the facility was turned into a house.