In the Battle of Marv (1510), Muhammad Shaybani was defeated and killed when trying to escape. Shaybani Khan's army was surrounded by Ismail's 17,000-strong army and was defeated after fierce resistance. The remnants of the army ended up dying under enemy arrows. At the time of Shaybani's death, the Uzbeks controlled all of Transoxiana, that is, the area between the Syr Darya and Amu Darya rivers. After capturing Samarkand from Babur, Shaybani married Babur's sister, Khanzada Begum. Babur's liberty to leave Samarkand was made contingent upon his assent to this alliance. After Shaybani's death, Ismail I gave liberty to Khanzada Begum with her son and, at Babur's request, sent them to his court. For this reason Shaybani was succeeded not by a son but by an uncle, a cousin and a brother whose descendants would rule Bukhara until 1598 and Khwarizm (later named Khiva) until 1687.