In 927, Kyon Hwon of Later Baekje led his forces into Silla's capital,
Gyeongju, capturing and executing its king,
King Gyeongae. Then he established
King Gyeongsun as his puppet monarch before he turned his army toward Goryeo. Hearing of the news, Taejo planned a strike with 5,000 cavalrymen to attack Kyon's troops on the way back home at
Gongsan near
Daegu in the
Battle of Gongsan. He met the Later Baekje army and suffered a disastrous defeat, losing most of his army including his generals Kim Nak and
Sin Sung-gyom, the very same man who crowned Wang as a king. According to the legend, Taejo and Sin Sung-gyom exchanged their armor so that the king would be able to escape the battlefield. While Wang Kŏn escaped the battlefield, Sin and the remaining army fought bravely against the Later Baekje army. But eventually his army was routed and in the woods Sin was shot with arrows and was killed by the enemy. Taejo escaped from this mountain and fled alone to the mountain , and he spent a few days hiding in a large cave at the peak of Apsan. While Taejo retreated from the battle and fled to Apsan Mountain, he left many place names related to him in Daegu. However, Goryeo quickly recovered from defeat and successfully defended Later Baekje's attack on its front. In 935, the last king of Silla, King Gyeongsun, felt there was no way to revive his kingdom and surrendered his entire land to Taejo. Taejo gladly accepted his surrender and gave him the title of prince, and accepted his
first cousin as his fifth wife and queen (Wang had six queens, and many more wives as he married daughters of every single local leader). In turn, King Gyeonsun married King Taejo's eldest daughter,
Princess Nakrang, whose daughter also intermarried into the royal Wang clan through her marriage with
King Gyeongjong; the grandson of King Taejo and Queen Sinmyeong. It caused much disgust to Kyon Hwon. Kyon's father,
Ajagae, who held his own claim to the
Sangju region, also defected and surrendered to Goryeo and was received as the father of a king. In the same year, Kyon Hwon's oldest son,
Kyŏn Sin-gŏm, led a coup with his brothers Yang-gŏm and Yong-gŏm, against their father, who favored their half-brother, Kŭm-gang, as his successor to the throne. Kyon Hwon was sent into exile and imprisoned in the temple of
Geumsansa, but escaped to Goryeo and was treated like Taejo's father, who died just before his surrender. ==Goryeo victory and unification==