Sofa Mosque

The Tent Kiosk and the Kiosk of the Swordbearer (Silahdarağa Köşkü) succeeded one another on the site where originally Sultan Mehmet the Conqueror had the Third Place Pavilion built at the time when the Topkapı Palace was first established. Sources mention that the original Sofa Mosque (Sofa Camii) was first erected along with the foundation of the corps called Sofa Ocağı during the period of Sultan Süleyman the Magnificent.
Sultan Mahmut II had the Kiosk of the Swordbearer torn down in 1809 because of it being the place where the dethroning plot of Sultan Selim II had been planned, and had the Sofa Mescit (small mosque) built in its place. In 1859, in parallel to the construction of the Mecidiye Pavilion and Wardrobe Chamber, Sultan Abdülmecit had the mescit demolished and built the present Terrace (Sofa) Mosque. From its epigraph written by Safvet, we understand that the mosque was built for the Treasury Superintendence and Treasury Ward officials to perform their prayers.
Sofalılar Ocağı, the Order of the Terrace Keepers, after which the mosque was named was an old palace organization. Their wards were located below the Tent Pavilion. The Terrace Keepers can be considered as part of the Palace Guards; they served as the guardians of the Fourth and Fifth places, and took care of the cleaning of the Chamber of the Holy Mantle.