Khalid was a member of the Shayban tribe, dominant in the region of Diyar Bakr in the northern Jazira,[1] and third son of Yazid ibn Mazyad al-Shaybani, who served twice as Arab governor (ostikan) of Arminiya (a large province encompassing the whole of Transcaucasia).
[3] As a result, when his re-appointment to the office was announced in 841, a rebellion broke out, forcing the Abbasid government to recall him immediately.
The latter arrived in the province at the head of an army, and crushed the opposition, headed by the Muslim rebel Sawada ibn Abd al-Hamid al-Jahhafi and the Christian princes Smbat VIII Bagratuni and Sahak of Syunik at the Battle of Kawakert.
[3] His younger son Haytham ibn Khalid ruled in the family's stronghold of Shirvan, and was the first to claim the title of Shirvanshah.
[3] In 822, Khalid briefly served as governor of Egypt, in an attempt by Caliph al-Ma'mun (r. 813–833) to re-establish Abbasid control over the province, which was divided by strife among rival Arab factions.