Baku Khanate

Baku Khanate (  — "Khānāt-e Baku"), was an autonomous Muslim principality under Iranian suzerainty, which existed between 1747 and 1806. Originally a province of Safavid empire, it became practically independent after the assassination of Nadir shah and weakening of central authority in Iran due to the struggle for power. Its territory now lies within present-day Azerbaijan,
History.
During the Russo-Persian War (1722-23), Baku, which was previously in Safavid possession, was occupied by Russian troops. However, when they heard of Nader Shah Afshar's military successes in Persia, and of the threat, he posed to Russia, they agreed to cede Baku to Persia again in 1735. The Shah appointed Mirza Muhammad Khan I, son of the influential tribal chief Dargah Quli Khan (who descended from Afshari Qizilbash who were granted lands near Baku in 1592), to become a feudal Khan. At this point, the Khan was practically and officially a vassal of the Persian Shah; however, it became independent in 1747, when Mirza Muhammad rose up against the Afsharid Persian Empire after Nader Shah Afshar's death in the same year. As the Empire was still in disarray after the Shah's death, the revolt easily succeeded, and although Baku formally stayed a vassal of the Iranian Shahs, the Khan was practically independent in his actions and decisions.
In 1768, the Khan of Quba, Fath 'Ali Khan, took Baku by force, and after an occupation of two years he installed his brother Abd Allah Beg, former puppet Khan of Shirvan, as the new Khan, turning Baku into a new dependency. However, in 1772 Mirza Muhammad's son Malik Muhammad Khan reclaimed Baku and became the new Khan. After his rule, which lasted until his death in 1783, his son Mirza Muhammad Khan II became Khan, but in 1791 the throne was asserted by Mirza Muhammad's uncle, Muhammad Quli Khan (father of writer Abbasgulu Bakikhanov). After a short rule of two years, he, in turn, lost the throne to his nephew Husayn Quli Khan, who was the son of his brother Hadjli Ali Quli. On 13 June 1796, a Russian flotilla entered Baku Bay, and a garrison of Russian troops was forcedly placed inside the city. Later, however, Tsar Pavel I ordered the cessation of the campaign and the withdrawal of Russian forces following the death of his predecessor, Tsarina Catherine the Great. In March 1797, the tsarist troops left Baku. Using this situation to his advantage, Mirza Muhammad Khan II came and took the Khanate back; however, he was deposed a second time in 1801, again by Husayn, who took power again. Mirza Muhammad fled and became the Khan of Quba from 1809 until 1810.
In the Russo-Persian War (1804-13), Russian forces led by general Pavel Tsitsianov sieged Baku and attempted to take in January 1806. However, when the keys of the city were given to the general, a cousin of Husayn Quli Khan shot him dead. Left without a leader, the Russians retreated, originally delaying the occupation of the city for a year, but they came back and took the city in October that year, led by general Bulgakov. Husayn Quli Khan had fled the city in between the sieges, and although he kept on claiming the Khanate as his, the Russians annexed it shortly after the siege. In the Treaty of Gulistan (1813), the Qajar Persians recognized the Russian annexation of their Caucasian vassals, including Baku, and gave up all their claims; however, it took several years before the Russians actually formed a new administration in Baku.