The siege of Andijan (to February 1498) was the end result of a conspiracy in his original kingdom of Fergana that forced Babur to abandon Samarkand only 100 days after it fell into his hands after a siege that ended in November 1497.
In the aftermath of the siege Babur had great problems keeping his army together. Samarkand had been subjected to two sieges in two years, and there was very little booty for Babur's men. As a result of this many of Babur's men, including some of the leaders of the army began to return home to Fergana.
Amongst them was Sultan Ahmad Tambal, a recently promoted member of Babur's entourage. Once back in Andijan Tambal began to conspire with Auzun Hasan, one of the men Babur had left in charge while he conducted the siege of Samarkand. The two men decided to try and convince Babur to give command of Andijan and Akhsi to his brother Jahangir, a weaker figure that they could hope to dominate (Tambal would later succeed in this ambition). Auzan Hasan and Ahmad Tambal were not the only men to cast their eyes on Andijan. Babur's uncle Sultan Mahmud Khan (the Elder Khan) also wanted the city.
When Babur refused to grant the rebel's demands they led their army from Akhsi to Andijan, and began a siege of the citadel. The defence was commanded by Ali dost Taghai, the second of Babur's deputies in Andijan. His problems can only have been made worse by the presence of Babur's mother, grandmother and religious advisor in the citadel.
Just to make things worse Babur was now taken seriously ill, and for four days was barely able to speak and had to have water dropped into his mouth from wet cotton. During this illness a messenger from the rebels was allowed into his presence. Seeing that Babur looked to be close to death, this messenger rushed back to Andijan to pass on the good news. The messenger then repeated his information to Ali-dost Taghai under oath, leaving the defenders of the citadel with little choice but to surrender.
On the very same day Babur had recovered sufficiently to lead his army out of Samarkand. Seven days later, at Khujand, he learnt of the surrender of the citadel. At the same time his remaining supporters in Samarkand had lost control of the city, which was now seized by Sultan Ali Mirza, Babur's ally in the successful siege.
All was not yet lost. Babur still had his army, and he now gained the support of the Elder Khan, who agreed to bring an army from Tashkent to help Babur regain his throne. Babur's relief was short-lived. After advancing in Fergana the Khan entered into negotiations with the rebels, and agreed to withdraw. Even then Babur still had 1,000 men under his command, but most of their families were in Andijan. Over the next few days most of them left Babur's service, leaving him with a hard-core of 200-300 supports with whom he went into exile.