stretching from Mongolia to the Caspian Sea. Introduced mainly as slave soldiers to the Samanid Dynasty, these Turks served in the armies of all the states of the region, including the Abbasid army. In the late 10th century, as the Samanids began to lose control of Transoxiana (Mawarannahr) and northeastern Iran, some of these soldiers came to positions of power in the government of the region, and eventually established their own states, albeit highly Persianized. With the emergence of a Turkic ruling group in the region, other Turkic tribes began to migrate to Transoxiana. The first of the Turkic states in the region was the Persianate Ghaznavid Empire, established in the last years of the 10th century. The Ghaznavid state, which captured Samanid domains south of the Amu Darya, was able to conquer large areas of Iran, Afghanistan, and northern India apart from Central Asia, during the reign of Sultan Mahmud. The Ghaznavids were closely followed by the Turkic Qarakhanids, who took the Samanid capital Bukhara in 999 AD, and ruled Transoxiana for the next two centuries. Samarkand was made the capital of the Western Qarakhanid state. According to Peter Golden, the Karakhanid state was one of the first Turkic-Islamic states. The Islamization of the Karakhanids and their Turkic subjects played an important role in the cultural development of the Turkic culture. In the late 10th - early 11th century for the first time in the history of the Turkic peoples, Tafsir (commentary on the Koran) was translated into the Turkic language. The founder of the Western Karakhanid Kaganate, Ibrahim Tamgach Khan (1040-1068), for the first time erected a madrasah in Samarkand with state funds and supported the development of culture in the region. One of the famous scholars was the historian Majid ad-din al-Surkhakati, who in Samarkand wrote the “History of Turkestan”, which outlined the history of the Karakhanid dynasty. The most striking monument of the Karakhanid era in Samarkand was the palace of Ibrahim ibn Hussein (1178-1202), which was built in the citadel in the 12th century, where fragments of monumental painting depicting a Turkic ruler were discovered. The dominance of Ghazna was curtailed, however, when the Seljuks led themselves into the western part of the region, conquering the Ghaznavid territory of Khorazm (also spelled Khorezm and Khwarazm). The Seljuks also defeated the Qarakhanids, but did not annex their territories outright. Instead they made the Qarakhanids a vassal