The abolition of the Albanian Arshakid dynasty by the Sassanids at the beginning of the 6th century created a foundation for a new entity ruled by the sovereigns titled the Shirvanshahs in the ancient Shirvan land, as well as in the basin of the rivers of Shabranchay and Gilginchay. Its northern border was Derbent. According to historical traditions, the establishment of this state was connected with the Sassanid Emperor Ardashir I (224-241) or Khosrow Anushirevan I (531-579). There is no information on the names of the first Shirvanshahs. It should be noted that the Shirvanshahs struggled for independence and controlled their country independently throughout history. Nevertheless, while under the rule of invaders, the Shirvanshahs served as vassals and paid taxes to their suzerains.
During the occupation of Arabs (X century and later), Shirvan bordered with the south-eastern foothills of the Caucasian Mountains to the north, the Kura separating Shirvan from Arran and Mughan to the south-west, the River Ganikh (Alazani) River to the north-west, the Caspian Sea to the east. Despite the heroic struggle of Shirvanshahs in the tenth century for independence, they were virtually eliminated after 1538. They collapsed under the pressure of the emerging Azerbaijani Safavid state. The capital of Shirvan was Shamakhi. In the 15th century the capital was moved to Baku, which had already been the residence of the Shirvanshahs since the 12th century.
«Azerbaijani states in history», Baku, 2012, p.73.