In Muharram ah 617/March 1220 ce Chinggis Khan led his armies to Bukhara as part of a larger campaign against the Khwārazmshāh Empire (616–621/1220–1225). The city quickly surrendered and was rapidly integrated into the growing Mongol Empire. In the subsequent decades, Bukhara enjoyed a speedy recovery under the stewardship of a series of Mongol officials, who patronized religious institutions, repaired the damage caused by the invasion, and mitigated some of the excesses of the Mongol armies stationed in Transoxania. Yet this revival was stunted in the second half of the 13th century when the Mongol Empire was divided by war. During this period different factions contested control of Transoxania, and Bukhara became the target of periodic raids and attacks. A full rehabilitation of the city had to wait until after 716/1317–1318, when alliances between the Mongol military elites and the popular religious leaders of Bukhara facilitated a new period of stability that would last until the fall of the last effective khan, Qazān Sultan, in 746/1346. Bukhara’s status as an intellectual, economic, and political capital of Transoxania was diminished during the period of Mongol rule. Samarqand was designated as the administrative capital of Transoxania for much of this period, and the presence of Mongol forces in Nakhshab saw Bukhara subordinated to the itinerate court of the Chaghadaid-Mongol princes. Nevertheless, the city continued to be seen as an important center of religious scholarship, and its prestige was boosted by the fact that it served as the base for two of the leading Sufi movements of its time, the Kubrawiyya and the Naqshbandiyya.