After Genghis Khan's death, the empire was subdivided into four kingdoms or Khanates. These eventually became quasi-independent after the Toluid Civil War (1260–1264), which broke out in a battle for power following Möngke Khan's death in 1259. One of the khanates, the "Great Khaanate", consisting of the Mongol homeland and China, became known as the Yuan dynasty under Kublai Khan, the grandson of Genghis Khan. He set up his capital in present-day Beijing. After more than a century of power, the Yuan was replaced by the Ming dynasty in 1368, and the Mongol court fled to the north. As the Ming armies pursued the Mongols into their homeland, they successfully sacked and destroyed the Mongol capital Karakorum and other cities. Some of these attacks were repelled by the Mongols under Ayushridar and his general Köke Temür.