Background
In 1244, Sakya Pandita left for Prince Godan's royal camp with two of his young nephews, the ten year-old Phagpa and six year-old Chhana, who later published a collection of Sakya Pandita's writings. On the way, they stopped in Lhasa, where Phagpa took the vows of a young Buddhist monk at the Jokhang monastery in front of the statue of the Jowo offered by the Princess Wencheng, the Chinese wife of Songsten Gampo. Sakya Pandita preached sermons along his way and arrived at Prince Godan's camp in 1247 in Lanzhou in the current province of Gansu, where the Mongol troops were exterminating Chinese by throwing them in a river. Sakya Pandita, horrified, gave religious instructions, and in particular that killing a sentient being is one of the worst acts according to Buddha Dharma.
After the death of Sakya Pandita, Phagpa remained at the camp of Prince Godan and learned the Mongolian language. Five years later Kublai Khan asked Godan to give him Chögyal Phagpa, who was then 23, and converted him to Buddhism. Shortly after, Kublai Khan in a succession fight, took over his brother, Möngke, and became the khan, the ruler of the Mongols and even later on became Emperor of China.
Kublai Khan commissioned Chögyal Phagpa to design a new writing system to unify the writing of his multilingual Yuan Dynasty. Chögyal Phagpa in turn modified the traditional Tibetan script and gave birth to a new set of characters called 'Phags-pa script which was completed in 1268. Kublai Khan decided to use the 'Phags-pa script as the official writing system of the empire, including when he became Emperor of China in 1271, instead of the Chinese ideogrammes and the Uyghur script.
Pagspa's diaries for 1271 mention a foreign friend of Kublai Khan, who was quite possibly one of the elder Polos or even Marco Polo, although, unfortunately, no name is given.
Thus began a strong alliance and the capital of Sakya, gDan-sa, became the capital of Tibet. This lasted until about the middle of the 14th century. During the reign of the 14th Sakya Trizin, Sonam Gylatsen, the Central Tibetan province of U was taken by the Myriarch, marking the "beginning of the end of the period of Sakya power in Central Tibet."