Babur's third and last attempt to reclaim Samarqand for himself and the Timurids was made possible by Shah Isma‘il when on 2 December 1510, the founder of the new Safavid state defeated and killed Shaibani Khan Uzbek near Merv. This city in modern Turkmenistan was approximately 150 miles northeast of the Iranian city of Mashhad. Babur learned of Shaibani Khan's death when his Miranshahi Timurid cousin, Wais Mirza, sent a messenger with the news also telling him that 20,000 Mongols – previously subjugated by the Uzbeks – had arrived in Qunduz. According to Haidar Mirza, Babur, always ‘the Padshah’ in his text, immediately left Kabul for Qunduz, taking the route with no high passes because it was winter. He reached Bamian and celebrated Ramadan on 1 January. He arrived at Qunduz in late January, where Wais Mirza and the Mughul troops greeted him.
In 1507, Wais Mirza had earlier gone to Badakhshan with Shah Begim – Babur's maternal or Mughul grandmother – when Shaibani Khan Uzbek seemed poised to march on Kabul from Qandahar. He had been living, what Haidar Mirza describes as a ‘miserable life’ in the isolated Badakhshan fortress of Zafar, harassed by Uzbek marauders and surrounded by hostile Badakhshan natives. After he heard about Shaibani Khan's death and sent his messenger to Babur, Wais Mirza went to Qunduz. He apparently hoped to assemble a joint anti-Uzbek campaign with Babur that might improve his own political fortunes and those of his displaced relatives, who had suffered badly after the Uzbek triumph in Mawarannahr.
It is impossible to say how many loyal troops Babur brought with him from Kabul. He had earlier commanded about 2,000 when he marched on Qandahar, but he had suppressed the recent revolt in Kabul with only 500 men. Whatever his force, sometime later that winter, Babur, Wais Mirza and some of the recently arrived Mongols crossed the Amu Darya, intending to attack the two Uzbek governors of Hisar. Yet, when they prepared to stage an attack on the camp of one of the Uzbeks, Hamza Sultan, they discovered that he had already fled.