as part of the independent principality of Shaki or Hereti, a vassal of the Armenian Bagratid kingdom. The population was mostly of Armenian origin and Armenian-speaking. The first Armenian prince of Shaki was Sahl Smbatean, who ruled with relative autonomy from the Abbasid Caliphate. By the 10th century, the Arab geographer, Ibn Haukal mentions that Shaki was ruled by the Armenian prince Prince Ishkhanik. From 1038 to 1105, the Armenian Kiurikian dynasty ruled Shaki as part of the Kingdom of Kakheti-Hereti. In 1117, the region was captured by the army of the Georgian king David IV. The city was also ruled by the Atabegs of Azerbaijan and the Khwarazmian Empire, before the Mongol invasion. Feudal era In the 13th and 14th centuries, the territory of the present Shaki district was a part of the state of Shirvanshahs. Management of Shaki was entrusted to the son of Rashid al-Din Hamadani – Jalat In the 30s of the 14th century, the local Oirat tribe took power. After the collapse of the Hulagu Khan's rule in the first half of the 14th century, Shaki gained independence under the rule of Sidi Ahmed Orlat. In 1392, Emir Timur captured Shaki, and the ruler of Shaki, Seyid Ali, was killed. Seyid Ali's son, Seyid Ahmed, who came to power, along with Shirvanshah Ibrahim I Derbendi, accompanied Timur on his third campaign against Azerbaijan in 1399. In 1444, Shaki, then known as Nukhi, was ruled by a Muslim family of Armenian origin whose reign lasted till 1551. In the early 1500s, Safavid king Ismail I (r. 1501–1524) conquered the area, but the town continued to be governed by its hereditary rulers, under Safavid suzerainty. Ismail's son and successor Shah Tahmasp (r. 1524–1576) put an end to this, and in 1551, he appointed the first Qizilbash governor to rule the town. The territory was annexed to the Safavid dynasty as the independent Sheki beylerbey reigned by Toygun-bey Qajar. Safavid rule was twice briefly interrupted by the Ottomans between 1578 and 1603 and 1724–1735. In 1734-1735, there was a revolt of poor people against the policy of Nadir Shah in the village of Bilecik (Shaki) In 1741, there was another uprising against the local ruler, Melik Najaf. Appointed by Nadir Shah, Haji Chelebi, who claimed descent from the hereditary Muslim-Armenian rulers of the province, announced the formation of an independent Sheki khanate in 1743. Upon learning of this,