|Khanate of Shirvan|
|Capital||Shamakhy, Agsu, Fit dag|
|-||Assassination of Nader Shah||1748|
|-||Annexation by Imperial Russia||1820|
In 1742 Shemakha was taken and destroyed by Nadir Shah of Persia, who relocated inhabitants into a new town under the same name about 16 miles to the west (now Agsu), at the foot of the main chain of the Caucasus. The new Shemakha was a residence of the Khan of Shemakha Hajji Muhammed Ali Khan, who ruled until 1765.
The smaller Old Shamakha khanate continued to exist under brothers Muhammad Said khan and (1748—1786) Aghasi Khan until the two killed Hajji Muhammed Ali Khan and united two khanates. After the merge, the New Shamakha was finally abandoned, and the old town rebuilt in 1786. During 1768—1789 the Shirvan khanate was occupied by the much stronger Quba Khanate and Shaki Khanate. Aghasi Khan was blinded and Muhammad Said Khan was taken captive to Derbent.
Children of Aghasi khan and Muhammad Said khan were killed or exiled from Shirvan. Once Fatali Khan died, they came back restored their khanate. Askar khan, Qasim khan and Mustafa khan ruled after decline of Quba Khanate. In 1795 the Russians captured Shemakha as well as Baku as part of Persian Expedition of 1796 by Valerian Zubov; but the conquest was once more abandoned, and Shirvan was not finally annexed by Russia until 1805. In December 25, 1805, Mustafa Khan and Pavel Tsitsianov signed a treaty of accession of the Shirvan Khanate of subjects of the Russian empire: "I, Mustafa Khan of Shirvan, my name, my heirs and successors forever deny solemnly from all vassalage, or under whatever title it may be, from all dependence on Persian or other powers and hereby declare before the whole world, that I do not recognize over himself and my successors autocracy other than the supreme and is. a., All-great Emperor, and his high successors-Russian imperial throne, promising loyalty to the throne, like a loyal servant of it, and what should be the custom to swear on the Holy Quran". Mustafa Khan ruled until 1820, when the khanate was liquidated.
- Hajji Muhammad Ali Khan (1748 - 1763)
- Aghasi Khan & Muhammad Said khan (1763 - 1768 )
- Puppets of Quba Khanate (1768 - 1778)
- Aghasi Khan (1778 - 1786)
- Askar Khan (1786 - 1789)
- Qasim Khan (1789 - 1796)
- Mustafa Khan (1796 - 1820)
Khanate of Shirvan consisted of regions named mahal. All mahals had their respective hereditary governors called naib. Mahals itself were complex of obas and village. The oba were villages with no permanent residents. Mahals of Shirvan:
- Mahal of Elat
- Karasubasar mahalı
- Mahal of Lahij
- Mahal of Rudbar
- Mahal of Navahi
- Mahal of Salyan
- Mahal of Mughan
Shirvan Khan's Tomb, Eddi Gyumbez, outside Baku, Azerbaijan