After the fall of the Sassanid Dynasty in AD 949, Persia dissolved into a mass of semi-independent statelets endlessly warring with each other, but eventually three main factions emerged. Media and Assyria were absorbed into Armenia, which had long been very culturally similar to northern Persia; and many of the northern and eastern provinces were overrun by various Turkic tribes, among whom the Khwarezmians eventually became dominant. In the centre, the Shansabani Dynasty, a native Persian dynasty of Pashtun origin, took control of Iran itself.
At around the same time the various Mongol tribes were being united one by one under the leadership of Temujin, known as Genghis Khan. From 1211-1214 the Mongols invaded northern China and brought the Jin Dynasty to the brink of destruction, though ultimately they were happy to withdraw after receiving an imperial fortune in tribute.