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.