The Shirvanshahs (singular: Shirvanshah, from Persian شروانشاه, lit. 'king of Shirvan') were the rulers of Shirvan (in present-day Azerbaijan) from 861 to 1538. Their realm was referred to as the Kingdom of Shirvan (Persian: پادشاهی شروان; Arabic: مملكة شروان) in writings completed during or shortly after its existence. The first ruling line were the Yazidids, an originally Arab and later Persianized dynasty, who became known as the Kasranids (also referred to as the Khaqanids). The second ruling line were the Darbandids, distant relatives of the Yazidids/Kasranids.
The Shirvanshahs ruled from 861 to 1538, one of the most enduring dynasties of the Islamic world. At times they were independent, often they had to recognize the overlordship of neighbouring empires. The dynasty is known for its patronage of culture, such as during the 12th century, when their realm served as the focal point for Persian literature, attracting distinguished poets such as Khaqani, Nizami Ganjavi, Falaki Shirvani, etc. In 1382, the Shirvanshahs' throne was taken by Ibrahim I (r. 1382–1417), thus marking the start of the Darbandid line.