Yazid ibn Ahmad

Yazid on the other hand, had to deal with Abd al-Barr b. Anbasah, former ruler of Qabala who used death of Muhammad to attack Shirvan in 992 in alliance with Shaki (probably Hereti or Kakheti).

Next year, he attacked Abd al-Barr and captured Gurzūl castle (modern Girdadul, Qabala) from him.

After his accession, Maymun I attacked Bab al-Abwab and recaptured Emirate of Derbent which was under dominion of Shirvan during reign of Muhammad.

Later in 998/999, new emir Lashkari I (son of Maymun I) defeated Yazid who contested ownership of an estate near Derbent.

Following a period of peace, Lashkari died in 1001/1002 and nobles of emirate asked for Abu Nasr to be succeeded.

Supported by locals, Anushirvan imprisoned his father's vizier Abd al-Aziz and looted his belongings.