Baku Khanate
The Baku Khanate (), was a khanate under Iranian suzerainty, which controlled the city of Baku and its surroundings from 1747 to 1806. Background 
The city of Baku, located in the South Caucasus, was originally part of the Shirvan province of Safavid Iran. Dargah Qoli Beg, whose family was originally from Mazandaran, governed the area in the early half of the 18th-century. Following the collapse of the Safavid government in 1722, Iranian authority in the South Caucasus started to dwindle. During the Russo-Persian War of 1722–1723, Dargah Qoli acknowledged Russian rule and retained his position until his dismissal in 1730, which occurred due to cooperating with Iran. He then went into the service of the Iranian military leader Nader, under whom he served as a commander. Following the withdrawal of the Russians, Dargah Qoli was re-appointed as governor of Baku. By 1735, however, the former Iranian holdings in the South Caucasus had been restored due to the efforts of Nader, who had re-stablished the former Safavid borders. It was also during this period that he set his sights on the throne, as he believed his campaigns had stabilised the country and brought him enough fame. On 8 March 1736, he was crowned the new shah (king) of Iran, thus abolishing the Safavid dynasty and starting the Afsharid dynasty. Dargah Qoli was killed in 1739 during the Iranian expedition into Jar and Taleh. He was succeeded by his son Mirza Muhammad Khan I, who also continued worked under Nader Shah in the military. History 
Following Nader Shah's assassination in 1747, Iran fell into turmoil, especially in the South Caucasus. There the Georgians and local khans fought over land. The area soon split into multiple semi-autonomous khanates and districts, such as the Baku Khanate. A khanate was a type of administrative unit governed by a hereditary or appointed ruler subject to Iranian rule. The title of the ruler was either beglarbegi or khan, which was identical to the Ottoman rank of pasha. The neighboring khanates were still seen as Iranian dependencies even when the shahs in mainland Iran lacked the power to enforce their rule in the area. It was during this period that Mirza Muhammad Khan I became a vassal of Fath-Ali Khan, the khan of the Quba Khanate. By 1762, the Zand ruler Karim Khan Zand () had established his authority in most of Iran, and was eventually acknowledged by Georgia and the various khans of the South Caucasus as their suzerain. The newly crowned Russian emperor Alexander I () reinstalled Catherine I's previous generals to their former positions, and also chose to resume her plans for the Caucasus. He installed Karl Knorring as the governor of Georgia, and instructed him to offer Russian protection to various khanates (including Baku) that the new shah Fath-Ali Shah had not established his hold over yet. This demonstrates that Alexander, unlike his father, sought to conquer the entire area that was situated between the Aras and Kur rivers. Russian soldiers were now permanently stationed in Tiflis and were prepared to advance to the banks of the Aras. It was crucial to convince the khan of Baku because his domain included the most important port on the Caspian Sea. Control over the region would make it possible for the Russians to send supplies from Astrakhan directly to the Russian soldiers in Georgia. The family adopted the name of Badkubeh after relocating to the city of Arak in Iran, whereas a different segment of the family that stayed and worked with the Russians adopted the name Bakikhanov. References

Sources
 
 
 
 
 
 
 
 
 
 

18th century in Azerbaijan
Khanates of the South Caucasus
History of Baku
History of Tats