Quba Khanate
In 1765, Fatali Khan conquered Derbent and united its khanate to his own possessions with the help of shamkhal, utsmi and Tabasaran’s qadi. Even by then he took territories on the right bank of the Samur River – Mushkur, Niyazoba, Shabran, Rustau, Beshbarmag and also villages of Ulus mahal from Derbent's khan. Subordinating Derbent, Fatali Khan gave a part of lands in Derbent Khanate to rulers of Dagestan as a sign of gratitude: Garadagli, Naburli, Chigi, Azagli, Bebeshli and Bebeli villages of Quba province to shamkhal of Tarki; Malakalil and Derbent provinces to utsmiy and allowed him to levy customs duties in Derbent; to qadi of Tabasaran was given a monetary compensation. Soon Fatali Khan married to Tuti Bike – daughter of Qaytaq utsmiy Amir Hamza. But in his turn, the Khan of Quba refused to marry his sister Khadija Bike to him. Instead he married her to Melik Mahammad Khan – son of Baku’s Khan Mirza Muhammad I. By means of Khadija Bike, who had a hard and masterful character, Fatali Khan subordinated weak-willed Khan of Baku to himself. Thus, he made Baku Khanate in state of dependence from Quba Khanate. As per relations with Amir Hamza, Fatali Khan drove Qaytaq tax collectors from Derbent and took away the village which he presented to utsmiy from him and it worsened contradiction between two rulers.