Кубинское ханство
After the disintegration of the Safavid Empire and after the death of Nader Shah, the semi-independent principality of Baku Khanate was formed in 1747 following the power vacuum which had been created. It was ruled by Mirza Muhammed Khan and soon became a dependency of the much stronger Quba Khanate. The population of Baku was small (approximately 5,000), and the economy was ruined as a result of constant warfare, banditry, and inflation. The khans benefited, however, from the sea trade with the rest of Iran. Feudal infighting in the 1790s resulted in the dominance of an anti-Russian faction in the city resulting in the Russian-leaning brother of the Khan being exiled to Quba.