Until the late Sallarid period they remained generally under the overlordship of the governors and rulers of Azarbaijan and Arran, but these interfered only occasionally in their affairs. Much of their efforts was devoted to raiding the nonMuslim petty principalities in the region and repelling their attacks. The two families were also engaged in a long, intermittent feud with each other. The Yazldids, who had a historical claim to al-Bab, time and again interfered in the affairs of this neighbour province and usually gained the upper hand. The Hashimids, whose hold over al-Bab was also permanently threatened by the power of the chiefs (ru'asd7 ) of the town, were repeatedly expelled and restored within a short time.
The Yazidids were descendants of Yazld b. Mazyad, a chief of the Arab tribe of Shaiban and prominent commander under Harun al-Rashid. Yazid was twice appointed governor of Azarbaijan and Armenia (171-2/787-9 and 183-5/799-801) and distinguished himself in fighting the Khazars. After him his three sons and his grandson Muhammad b. Khalid were repeatedly sent as governors to Azarbaijan, Armenia and Arran. Muhammad b. Khalid in 245/859-60 restored the town of Ganja and was granted it together with some estates as a hereditary fief. His brother al-Haitham probably under him became governor of Sharvan.
As the disturbances following the murder of the caliph al-Mutawakkil in 247/861 weakened the central government, he was able to retain his dominion and bequeath it to his son. A third brother, Yazld, in the same period established himself in Laizan, a small region in northern Sharvan. Al-Haitham and Yazld adopted the traditional titles Sharvan-Shah and Laizan-Shah. The dynasty soon became Persianized and claimed descent from Bahram Gur.
The Banu Hashim were descendants of a client of the Arab tribe of Sulaim of unknown origin. The Sulaim were powerful in al-Bab, and the Hashimids were one of the families of prominence among them. Al-Najm b. Hashim is mentioned as the lord of al-Bab representing the local interests about the year 180/796. When the inhabitants of the town attacked their tax collector, al-Najm was killed by the governor of Armenia. His son Hayyun revolted and asked the Khazars for help, who came with a strong army and penetrated as far as the Kur river causing much damage to the Muslims before they withdrew. Despite this traitorous activity, the Hashimid family did not lose its influence in al-Bab. In 25 5/869 the inhabitants and the ghazis of the town raised a great-grandson of Hayyun, Hashim b. Suraqa b. Salis, as their amir, and from that date the family reigned on a hereditary basis. Hashim led two successful raids into the Avar country known as al-Sarir in 263/876-7 and 265/878-9. After his death in 271/884-5 he was succeeded by his son cAmr, who died after a year and was succeeded by his brother Muhammad. Muhammad in 273/886-7 carried out a successful raid on Shandan, northwest of al-Bab, and in 288/901 beat off a Khazar attack. Less fortunate were his relations with al-Sarir.
In 292/905 Muhammad in a battle was captured together with ten chiefs of al-Bab by the lord of al-Sarir, who later released them with generous presents. In 297/909- 10 (according to another version in 300/912-13) Muhammad led another campaign against Shandan jointly with the Sharvan-Shah 'All, greatgrandson of al-Haitham b. Khalid, who had succeeded to the rule after his grandfather Muhammad and his father al-Haitham. The Muslims suffered a crushing defeat by the army of Shandan, al-Sarir and the Khazars. The two rulers and 10,000 men were captured. Those falling into the captivity of the Saririans as well as the two rulers were freed after a few months, while most of the others were sold into slavery. It was perhaps during the captivity of Muhammad, between 296/909 and 299/912, that the Sajid Yusuf came to al-Bab and rebuilt the walls of the town. Muhammad died in 303/916 and was succeeded by his brother cAbd al-Malik.