Arab rule in Central Asia came to an end as a result of the Saffarid conquest. During their dominion Merv, like Samarkand and Bokhara, was one of the great schools of learning, and the celebrated historian Yaqut studied in its libraries. Merv produced a number of scholars in various branches of knowledge, such as Islamic law, Hadith, history, literature, and the like. Several scholars have the name: Marwazi (المروزي) designating them as hailing from Merv. But Saffarid rule was brief and they were defeated by Samanids in 901. The Samanid dynasty weakened after the second half of the 10th century and Ghaznavids took present Turkmenistan in the 990s. But, they challenged with Seljuks, newcomers from north. Seljuks' decisive victory against them, present Turkmenistan was passed to them in 1041. Oghuz tribes The origins of the Turkmen may be traced back to the Oghuz confederation of nomadic pastoral tribes of the early Middle Ages, who lived in present-day Mongolia and around Lake Baikal in present-day southern Siberia. This confederation was composed of Turkic-speaking peoples who formed the basis of powerful steppe empires in Inner Asia. In the second half of the 8th century, Oghuz components migrated through Jungaria into Central Asia, and Arabic sources located them under the term Guzz in the area of the middle and lower Syrdariya in the 8th century. By the 10th century, the Oghuz had expanded west and north of the Aral Sea and into the steppe of present-day Kazakhstan, absorbing not only Iranians but also Turks from the Kipchak and Karluk ethnolinguistic groups. In the 11th century, the renowned Muslim Turk scholar Mahmud al-Kashgari described the language of the Oghuz and Turkmen as distinct from that of other Turks and identified twenty-two Oghuz clans or sub-tribes, some of which appear in later Turkmen genealogies and legends as the core of the early Turkmen. In Old Turkic inscriptions, there are references to several Oghuz groups like simply Oghuz, Üç-Oghuz ("three-Oghuz"; possibly Karluks), Altı-Oghuz ("six-Oghuz"), Sekiz-Oghuz ("eight-Oghuz"), possibly *Otuz Oghuz ("Thirty Oghuz"), and the Tiele-affiliated Toquz Oghuz ("nine-Oghuz") (Chinese: 九姓 Jiu Xing "Nine Surnames") in different areas in the vicinity of the Altay Mountains. Despite, the similarity of names, the Toquz Oghuz confederation, from whom emerged the founders of the Uyghur Khaganate, was distinct from the Transoxanian Oghuz Turks who'd later found the Oghuz Yabgu State: for instances, Istakhri and Muhammad ibn Muhmad al-Tusi kept the Toquz