The eruption of instability following Nader Shah's death in 1747 gave rise to the various  Caucasian khanates. The semi-autonomous Persian-ruled Baku Khanate (1747-1806) was one of these. Initially ruled by  Mirza Muhammed Khan (), it soon became a dependency of the much stronger Quba Khanate. During this time, the population of Baku remained small (approximately 5,000), and the economy suffered as a result of constant warfare.