Muhammad Shaybani was initially an Uzbek warrior leading a contingent of three thousand men in the army of the Timurid ruler of Samarkand, Sultan Ahmed Mirza under the Amir, Abdul Ali Tarkhan.
However, when Ahmed Mirza went to war against Sultan Mahmud Khan, the Khan of Moghulistan, to reclaim Tashkent from him, Shaybani had secretly met the Moghul Khan and agreed to betray and plunder Ahmed's army.
This had occurred in the Battle of the Chirciq River in 1488, resulting in a decisive victory for Moghulistan.
Sultan Mahmud Khan had given Turkistan to Shaybani as a reward.
Here, however, Shaybani had oppressed the local Kazakhs, resulting in a war between Moghulistan and the Kazakh Khanate.
Moghulistan had been defeated in this war, but Shaybani had gained power among the Uzbeks, and had decided to conquer Samarkand and Bukhara from Ahmed Mirza.
Sultan Mahmud's subordinate emirs persuade him to aid Shaybani in doing so, and together they march on Samarkand.
Shaybani, continuing the policies of his grandfather, Abul-Khayr Khan, by 1500 ousts the Timurids from their capital.