Siege of Samarkand (1497)
In May 1497 the two armies of Babur and Sultan Ali successfully besieged and captured the city of Samarkand. Siege 
Babur led his army into the territory of Sultan Baysonqor Mirza and after various successes encamped at Yam, a village not far from Samarkand. Some skirmishes followed. From Yam, Babur moved his camp to Yurat Khan, a station four or five miles from the city where he remained forty or fifty days. Many severe actions took place with considerable loss on both sides. On one of these occasions a party that, on the treacherous invitation of some of the townspeople he had sent to surprise the city by night, on the side of the Lovers Cave, fell into an ambush by which some of his bravest soldiers were slain and others taken prisoner and afterwards put to death. While he remained there however the inhabitants of all the neighboring country submitted and surrendered their strongholds to him. From the station of Yurat Khan, Babur moved first to the meadow of Kulbeh and next to the hill of Kohik on a different side of the town. When the people of Samarkand saw the army on its march from the one position to the other thinking that it was on its retreat and elated with their supposed success they sallied out both soldiers and citizens in great numbers towards two bridges crossing the River Kohik (today known as Zarafshan River) in that direction. Babur observing this movement watched for the favorable moment when he ordered a charge of cavalry to be made upon them. It was completely successful. Numbers were cut down and many, both horse and foot, taken prisoner. The higher officers and the soldiers were treated with the usual courtesy of the time. The same indulgence was not extended to the citizens. The besiegers were allowed to advance unopposed up even to the ditch and to carry off provisions from under the very walls. But the city itself was not captured and again winter was approaching. Babur was nevertheless resolved not to leave the territory. He therefore decided to break up from before the city and to erect temporary huts for the troops in some neighboring forts by which means they could still keep Samarkand in a state of blockade. For this purpose the fort of Khwaja Didar was pitched upon for headquarters and the necessary erections were begun in and around it without delay. When they were finished the army moved into them. Some officers however went with their men to towns at a greater distance to secure better winter accommodation so that the army was rather scattered. Uzbek relief attempt 
At this critical juncture came an explosion of Uzbeks on the request of Baysonqor Mirza, under their leader Muhammad Shaybani, who would become Baburs' nemesis. Babur, though his forces were dispersed, resolved to show a bold countenance, put the troops that were with him in array and marched out to face the enemy. Shaybani who had hoped to take him by surprise, finding him on the alert, did not choose to hazard an action and drew off towards Samarkand. Baysonqor Mirza, who had expected much more effectual relief from so formidable a reinforcement, was disappointed and vexed at the result and could not conceal his feelings, so he did not give Shaybani the favorable reception he had expected while the Uzbek who in the course of his expedition short, as it was, had seen at once the richness of the prey and the weakness of its defenders returned a few days after to Turkistan. This is the first hostile appearance of that remarkable man who afterwards exercised so powerful an influence on the fate of Babur and of Samarkand. Fall of the city 
That city had now sustained a siege for seven months. Baysonqor Mirza had played his last hope of relief on the arrival of the Uzbek army. Seeing that too fail he gave himself up to despair, abandoned the place and his kingdom, and attended only by a few attached followers took the road to Kunduz, Afghanistan. That district, which lies beyond the Amu Darya between Balkh and Badakhshan was then held by Khusroe Shah who was nominally subject to Sultan Masud Mirza of Hissar but with whom since that prince's retreat from Hissar he had quarreled and of whom he was in reality independent. Masud Mirza could have no wish that his brother and rival should be able to unite himself with a protector so formidable as Khusroe Shah, and Baysonqor Mirza the fugitive prince in passing through the territory of Hissar escaped with difficulty from an attempt made to seize him though not without the loss of several of his followers who fell into Masud's hands. He finally, however, did succeed in reaching Kunduz where he was well received by Khusroe Shah who though he had been the chief minister of his father being at that time engrossed with his own schemes of power and of conquest regarded Baysonqor Mirza as a fit instrument for his soaring ambition. No sooner did Babur hear of the flight of Baysonqor Mirza than he hastened from his cantonments towards Samarkand and took the city without opposition. What share Sultan Ali Mirza had in these transactions does not appear, as no mention being made of him during the siege. Babur, whether in consequence of special agreement or of his superior activity alone, entered the city. Sultan Ali had previously, however, overrun some of the dependent districts especially those in the neighborhood of Bukhara and continued to retain possession of them as well as of that city. The city of Samarkand, the possession of which thus rewarded the perseverance of the youthful Babur was one of the richest and most populous at that time in the world. It had been the capital of the great Timur and still maintained its preeminence in the countries he had conquered. Aftermath
Both Begs and soldiers who had looked forward to the rich plunder that it was to afford as the reward of the toils they had endured in a long siege were extremely discontented when they discovered that the city was worn out from the long continuance of the blockade for which it was not originally prepared, the country laid waste by the movements of hostile armies for two successive summers had been reduced to such a wretched condition that instead of any supplies being drawn from the fertile fields around, it was absolutely necessary for the government to furnish the inhabitants with seed corn to sow their grounds and with other supplies to enable them to subsist on till the ensuing harvest. To levy contributions for his army from such a country was, as Babur himself remarked, quite impossible. His soldiers were consequently exposed to much distress and he possessed no adequate means of satisfying their wants. The men began to drop off and return home. The example set by the soldiers was soon followed even by their leaders. All his Mughal horse deserted, and in the end, Sultan Ahmed Tambol, a Mughal nobleman of the first rank in Andijan, forsook him like the rest and returned home. Ahmed Tambol rebelled and took over his Kingdom of Ferganal, supporting Babur's brother Jahangir Mirza as the new king and joined by Uzun Hasan. The rebels lay siege to Andijan. As Babur was marching to recover his lost kingdom, his troops deserted him in Samarkand, leaving him with neither Samarkand nor Fergana. While in 1500 CE he planned to retake Samarkand, he learnt that the Khan of the Uzbeks, Muhammad Shaybani, was headed towards the city. See also
Baburnama

References 

Ewans, Martin (September 2002). Afghanistan: A Short History of Its People and Politics. HarperCollins. pp. 26–7. Samarkand
Samarkand
Military history of Uzbekistan
History of Samarkand
1497 in Asia