Seljuq dynasty
The founder of the Seljuq dynasty was an Oghuz Turkic warlord Seljuk. He was reputed to have served in the Khazar army, under whom, the Seljuks migrated to Khwarezm, near the city of Jend, where they converted to Islam in 985. Khwarezm, administered by the Ma'munids, was under the nominal control of the Samanid Empire. By 999 the Samanids fell to the Kara-Khanids in Transoxania, but the Ghaznavids occupied the lands south of the Oxus. The Seljuks became involved, having supported the last Samanid emir against the Kara-Khanids, in this power struggle in the region before establishing their own independent base.