Sajid dynasty

Muhammad's father Abu'l-Saj Devdad had fought under the Ushrusanan prince Afshin Khaydar during the latter's final campaign against the rebel Babak Khorramdin in Azerbaijan, and later served the caliphs.

Toward the end of the tenth century, as the central authority of the Abbasid Caliphate weakened, Muhammad was able to form a virtually independent state.

Thus, at the beginning of the tenth century, the Sajid state included territories from Zanjan in the south to Derbent in the north, the Caspian Sea in the east, to the cities of Ani and Dabil in the west, covering most of the lands of modern Azerbaijan.

[8] During the reign of Yusuf ibn Abi'l-Saj, Russian raiders attacked the Sajid territory from the north via the Volga in 913–914.

Yusuf ibn Abu Saj repaired the Derbent wall to strengthen the northern borders of the state.