Unable to reclaim the dictatorship for himself and now a political fugitive, Yeon Namsaeng was left with no choice and eventually defected to the Tang along with 100,000 Goguryeo soldiers.
The Emperor of China Gaozong then sent an 80,000-strong army led by generals Xue Rengui, Li Shiji and Qibi Heli based in Liaodong to rendezvous with the defectors.
In October 667 the Tang forces went on to attack Buyeo (present-day Nong'an County, part of Changchun, Jilin), the last city in the north of Goguryeo that has not fallen yet.
The vanguard of the Tang army, commanded by generals Pang Tongshan and Gao Kan, were near the fortress of Geumsan (Korean: 금산성 Geumsan-seong, Chinese: 金山 Jīnshān, in present-day Changtu County, Liaoning) which was on their path heading to Buyeo, when the Goguryeo army led by Yeon Namsan recently arrived.
Xue Rengui had his 2,000-strong elite cavalry wear white robes as camouflage and had it charged onto the unsuspecting Goguryeo camp, killing 20,000 soldiers and routing the rest back to Buyeo.