While visiting the Sheki Castle where the Palace of Sheki Khans is located you will have an opportunity to see some ancient monuments. One of these monuments is the castle itself. We know from history that the population of Sheki during the attacks of the foreign invaders were leaving the city, finding refuge in the nearby castles. For example, the world-famous military leader, Nadir Shah Afshar while attacking Sheki Haji Chalabi Khan, took refuge and defended in the fortress of Gelersen-in-Gorersen a few kilometers outside of the city. Nadir Shah who reckoned with inaccessibility of the castle, was forced to return back, giving the title of Khan to Haji Chalabi. However, during the time when the khanate developed the part of Naringala of the city is started to be enclosed with castle walls. In general, the medieval cities of Azerbaijan consisted of three parts. The first part was Naringala where shahs and khans live with their families and relatives, the next was shahristan, the state-owned enterprises was located here, in the last part called as rabbat craftsmen and merchants were inhabited. Usually after Naringala, also the shahristan was enclosed in castle walls. But in Shaki only Naringala had been strengthened with walls. In 1765 they started to build walls around the city. With the overflow of the river Kish, this ancient city is almost totally destroyed in 1772. Some people moved to other places, some of them were transferred to the city laid out in a new place. When you visit Shaki you will get a chance to see those walls. The total length of the walls from the outside is 1300 metres, the height in the Northern part is 4 metres, in the Southern part is 8 metres. The thickness of the walls is 2.2 metres. There are two arched gates, 21 security towers and more than 1000 embrasures in the Northern and Southern part of the castle.