The battle of Kul-i-Malik (May 1512) was a defeat for Babur that forced him to abandon Samarkand, ending his third and final period in command of that city. Babur had seized Samarkand in 1511, taking advantage of the confusion that followed the death of the Uzbek conqueror Shaibani Khan at the hands of the Persians at the battle of Merv in 1510. In the aftermath of Shaibani's death rebellions had broken out across his empire. Babur had intervened to support the rebels, and to reclaim his ancestral home. After defeating an Uzbek army at Pul-i-Sanghin he had chased them out of Bokhara and then in October 1511 entered Samarkand in triumph.
At first Babur was greeted as a liberator, but his triumph was marred by religion. In order to conquer Samarkand he had entered into an alliance with Shah Isma'il of Persia, a violently bigoted Shiite. One of the conditions of the alliance (in which Babur was very much the junior partner) was that Babur would impose the Shah's beliefs on the Sunni population of Samarkand. Although Babur didn't persecute his new subjects, his public adoption of Shiite dress and customs caused great offense, and eroded his support in the city. This had two main consequences -when the Uzbeks returned in 1512 Babur was unable to call on his new subjects to fill out his army, and after his defeat at Kul-i-Malik he was unable to rely on them in any potential siege of Samarkand.
The details of the battle are sadly obscure. It took place during one of a number of gaps in Babur's own memoirs, so his account is missing. The Tarikh-i-Rashidi of Mirza Muhammad Haidar, normally an excellent source, is distorted at this point by the author's hatred of the Shiites. While every other source has Babur badly outnumbered, Haidar gives him 40,000 and the Uzbeks 3,000, and credits the Uzbek's victory to their Sunni religious beliefs.
The outline of the campaign is more certain. After their defeat in 1511 the Uzbek sultans had recovered some of their confidence. Babur had sent away his Persian troops, but lacked support in Samarkand. Sensing his weakness the Uzbeks gathered a new army and invaded Babur's new possessions. The main army advanced towards Tashkent, while a second, under the command of Ubaid Khan, moved towards Bokhara.
The size of Babur's army is uncertain. In previous emergencies he had been able to rely on a core of 300-500 loyal fighters, who on occasions had defeated much larger enemy armies. This would not be the case at Kul-i-malik, and after a fierce battle Babur was defeated. The battle was probably a fairly evenly balanced affair, for in the aftermath Babur was able to get into Bokhara in safety, and then when it was clear that he could not hold that place he was able to escape to Samarkand.
It was soon clear that Samarkand could not be held. Babur was forced to abandon Tamerlane's city for the third and final time, and flee to Hisar. His supports attempted to hold out in Tashkent and Sairam, although both places eventually fell to the Uzbeks. Babur was able to hold on to Hisar for long enough for a Persian army to reach him, but after this army was defeated at Ghaj-davan on 12 November 1512 Babur was forced to return to his Afghan kingdom.