gave Turkistan to Shaybani as a reward. Here, however, Shaybani oppressed the local Kazakhs, resulting in a war between Moghulistan and the Kazakh Khanate. Moghulistan was defeated in this war, but Shaybani gained power among the Uzbeks. He decided to conquer Samarkand and Bukhara from Ahmed Mirza. Sultan Mahmud's subordinate emirs convinced him to aid Shaybani in doing so, and together they marched on Samarkand. Foundation of Shaybanid Dynasty Continuing the policies of his grandfather, Abul-Khayr Khan, Shaybani ousted the Timurids from their capital Samarkand by 1500. He fought successful campaigns against the Timurid leader Babur, founder of the Mughal Empire. In 1501 he recaptured Samarkand and in 1507 also took Herat, the southern capital of the Timurids. Shaybani conquered Bukhara in 1506 and established the Shaybanid Dynasty of the Khanate of Bukhara. In 1508–09, he carried out many raids northward, pillaging the land of the Kazakh Khanate. However he suffered a major defeat from Kazakhs under Kasim Khan in 1510. Foreign policy Shaybani Khan maintained ties with Ottoman Empire and China. In 1503, his ambassadors arrived at the court of the Ming Empire Emperor. In Alliance with the Ottoman Sultan Bayezid II (1481-1512), Shaybani Khan opposed the Shia Safavid Shah Ismail I. Religious policy Shaybani Khan did not make any distinction between Iranians and Turks on the basis of ethnicity, but followed the hadith of the Islamic prophet Muhammad: "All Muslims are brothers". One of the authoritative religious figures, a native of Yemen, Emir Sayyid Shams ad-Din Abdallah al-Arabi al-Yamani al Khadramauti (known as Mir-i Arab), enjoyed the patronage of Shaybani Khan, and constantly took part in the meetings of the diwan (court) and accompanied the Khan in his campaigns. Shayibani Khan wrote a prose essay called "Risale-yi maarif-i Shayibani" in the Central Asian Turkic - Chagatai language in 1507 shortly after his capture of Khorasan and is dedicated to his son, Muhammad Timur (the manuscript is kept in Istanbul). The manuscript of his philosophical and religious work: "Bahr ul-Khudo", written in the Central Asian Turkic literary language in 1508 is located in London. Later years The last years of Shaybani Khan were not easy. In the spring of 1509, his mother died. After her funeral in Samarkand, he went to Qarshi, where he held a meeting with relatives and allowed them to disperse to their uluses (beyliks or small countries). Ubaydulla's nephew went to Bukhara, Muhammad Temur to