The invasion finally commenced on 1 April 645, when Tang forces led by general Li Shiji, under orders from the Emperor, crossed into Goguryeo territory with his army.
Yeon Gaesomun proceeded to mobilize an army of 150,000 soldiers led by generals Go Hye-jin and Go Yeon-su to bolster the northern defenses of the kingdom by June 645.
Spies and mounted scouts scouring the northern part of Goguryeo reported to Emperor Taizong that a sizeable relief force from Pyongyang is on the way to prevent Ansi from falling to the Tang.
A war council was then convened thereafter with the Emperor at the head, telling his generals that earthworks needed to be made that are to be perfectly situated at steep hills surrounding Ansi to prevent any chance of escape by the defenders of the city, while the army would face the relief force and hid a small cavalry detachment led by prince Li Daozong in a hill to flank the relief force from the rear; the battle would thus be decided in a hammer and anvil fashion as the Emperor planned.
The Goguryeo cavalry led by Go Yeon-su charged across the plain dominating the battlefield at the foot of Jupil Mountain just south of Ansi, towards the Tang infantry that was awaiting them in a shield wall formation.
When Emperor Taizong finally deemed the time right to spring his trap, he ordered to sound the drums and horns to signal the flanking attack by Zhangsun Wuji and other generals with an 11,000-strong cavalry detachment from behind hidden in a hill north of Mount Jupil until now.
Worse came when they found out that the bridges in the river that leads them back to the main body of their army were already torn down by the Tang commander Zhangsun Wuji under orders from Emperor Taizong who already foresaw the event.
[1] Among these, the Tang forces sent 3,500 officers and chieftains back to China, executed 3,300 Mohe troops, and eventually released the rest of the ordinary Goguryeo soldiers.
After the battle, the Emperor officially began the siege of the city that would go on for three months before being lifted due to the onset of bad weather and dwindling of supplies on part of the besiegers.