As the "nisba" in his name suggests, he was a Khazar by origin, and is said to have been a slave working in the kitchen of Sallam al-Abrash al-Khadim—whence his nickname "al-Tabbakh", "the cook"—before he was purchased as a "ghulām" by al-Mu'tasim in 815. He rose to become one of the senior commanders in al-Mu'tasim's "Turkic" guard, and participated in several expeditions such as the Sack of Amorium.