When the Tang dynasty collapsed, China entered the Five Dynasties and Ten Kingdoms period, and as for the consequence of the repeated instability, the Vietnamese eventually set free from China in 938, delivered a devastating blow to Chinese expansionism. China proper was unified by the Song dynasty, and soon the Song dynasty sought to revive expansionism, and launched an invasion of northern Vietnam in the process, but was repelled by Lê Hoàn. From then, the Song dynasty had struggled to reconsolidate back the borderland and inner territories, as well as repeated wars with Vietnam, the Liao dynasty, the Jin dynasty and the Western Xia. This had prevented the Song dynasty from ever taking any serious military expeditions, and this would stay so until its conquest by the Yuan dynasty in 1279.