First campaign in the Goguryeo–Tang War

The Goguryeo–Tang War started when Emperor Taizong (r. 626-649), the Tang Dynasty emperor, initiated a military campaign against Goguryeo to protect Silla, an ally, and punish Generalissimo Yeon Gaesomun for killing King Yeongnyu of Goguryeo. The campaign against Goguryeo was launched in 645. It was commanded by Emperor Taizong, General Li Shiji, General Li Daozong, and General Zhangsun Wuji.

In 645, after defeating the main Goguryeo army, Emperor Taizong appeared poised to march on Goguryeo's capital Pyongyang and conquer Goguryeo, but became bogged down by the strong defenses put up by the defender of Ansi, traditionally believed to be Yang Manchun, before withdrawing for winter.

Background
King Yeongnyu planned to have Yeon Gaesomun killed, because he considered Yeon to be violent and criminal. However, Yeon received news of it and killed the king. Afterwards, he held actual control of the government and the military through the puppet King Bojang of Goguryeo.

In 643, Silla's Queen Seondeok of Silla submitted a report claiming that her state was under heavy attack by Goguryeo and Baekje. She requested aid from Tang. Emperor Taizong sent the official Xiangli Xuanjiang (相里玄獎) to demand Goguryeo and Baekje to cease attacking Silla. In the Goguryeo capital Pyongyang, Yeon Gaesomun refused to follow Emperor Taizong's order, given by with Xiangli.

Course
Emperor Taizong used as the pretext for an invasion Yeon Gaesomun's murder of the Goguryeo king. The preparations for an invasion began in 644. General Li Shiji commanded an army of 60,000 Tang soldiers and an undisclosed number of tribal forces. They would gather at Youzhou. Emperor Taizong commanded an armored cavalry of 10,000 strong. His cavalry would eventually meet up and join General Li Shiji's army during the expedition. A fleet of 500 ships would also transport an additional 40,000 conscripted soldiers and 3,000 military gentlemen (volunteers from the elite of Chang'an and Luoyang). This fleet would sail from the Liaodong Peninsula to the Korean Peninsula.

In April 645, General Li Shiji's army departed from Yincheng (present-day Chaoyang). On 1 May, they crossed the Liao River into Goguryeo territory. On 16 May, they laid siege to Gaimou (Kaemo). It fell after only 11 days. They captured 20,000 people. They also confiscated 100,000 shi (6 million liter) of grain.

Afterwards, General Li Shiji's army advanced to Yodong (Liaodong in Chinese). On 7 June 645, they crushed a Goguryeo army of 40,000 troops strong, who were sent to the city to relieve the city from the Tang siege. A few days later, Emperor Taizong's cavalry arrived at Liaodong. On 16 June, the Tang army successfully set Liaodong ablaze with incendiary projectiles and breached its defensive walls, resulting in the fall of Liaodong to the Tang forces.

The Tang army marched further to Baegam (Baiyan in Chinese) and arrived there on 27 June 645. However, the Goguryeo commanders surrendered the city to the Tang army. Afterwards, Emperor Taizong ordered that the city must not be looted and its citizens must not be enslaved.

On 18 July 645, the Tang army arrived at Ansi (Anshi in Chinese). A Goguryeo army, including Mohe troops, were sent to relieve the city. The reinforcing Goguryeo army totaled 150,000 troops. However, Emperor Taizong sent General Li Shiji with 15,000 troops to lure the Goguryeo forces. Meanwhile, another Tang force would secretly flank the enemy troops from behind. On 20 July, the two sides descended into battle and the Tang army came out victorious. Most of the Goguryeo troops dispersed after their defeat. The remaining Goguryeo troops fled to a nearby hill, but they surrendered the next day after a Tang encirclement. The Tang forces took 36,800 troops captive. Of these prisoners, the Tang forces sent 3500 officers and chieftains to China, executed 3300 Mohe troops, and eventually released the rest of the ordinary Goguryeo soldiers. However, the Tang army could not breach into the city of Ansi. This city was defended by the forces of Yang Manchun. Emperor Taizong considered abandoning the siege of Anshi to advance deeper into Goguryeo, but Anshi was deemed to pose too great of a threat to abandon during the expedition. In mid-September 645, the harsh winter worsened the conditions for the Tang army, which compelled Emperor Taizong to withdraw his forces from Goguryeo.

Aftermath
The campaign caused Goguryeo to fall into famine. In 647 and 648, Emperor Taizong decided to harass Goguryeo's frontier regions. It was said that both of these forces were successful in inflicting serious losses on Goguryeo forces.

Believing that Goguryeo had been weakened by these attacks, Emperor Taizong prepared for the resumption of the invasion in 649. However, Emperor Taizong died in the summer of 649. Li Zhi succeeded him as Emperor Gaozong, who would eventually continue the military conflict.