The Mongol invasions of Korea lasted from 1231–1259, and Goryeo capitulated to the Mongol empire under an agreement of a condition "not changing the local custom" (不改土風), and became their son-in-law nation (駙馬國) in 1270 until 1356. In the mid-14th century, when the Yuan dynasty was beginning to crumble due to the Red Turban Rebellion, Gongmin reformed the Korean government, abolished Mongolian military outposts, purged pro-Yuan sentiments, and regained lost northern territories. The Red Turbans attacked Goryeo most likely because of military exigency.