First conflict of the Goguryeo–Tang War

The first conflict of the Goguryeo–Tang War started when Emperor Taizong ((r. 626 – 649)) of the Tang dynasty led a military campaign against Goguryeo in 645 to protect Silla and punish Generalissimo Yeon Gaesomun for the killing of King Yeongnyu. The Tang forces were commanded by Emperor Taizong himself, and generals Li Shiji, Li Daozong, and Zhangsun Wuji.

In 645, after capturing multiple Goguryeo fortresses and defeating large armies in his path, Emperor Taizong appeared poised to march on the capital Pyongyang and conquer Goguryeo, but could not overcome the strong defenses at Ansi Fortress, which was commanded by Yang Manchun at the time. Emperor Taizong withdrew after more than 60 days of battle and unsuccessful siege.

Background
In 642, Goguryeo had enjoyed nearly 700 years of independence since Dongmyeong defeated all the opposition and the Han dynasty. Goguryeo reached its peak during the reign of Gwanggaeto the Great, who ruled the kingdom from 391 to 413. Under his reign, Goguryeo became one of the great powers in East Asia, subdued neighboring kingdoms and achieved a loose unification of the Korean peninsula. After a period of prosperity, Goguryeo began to decline in the end of the 5th century due to internal strife.

In 551, the two southern countries, Baekje and Silla, allied with each other and attacked the Han River basin region. Silla then betrayed Baekje and drove its forces out of the region, thus securing for itself the whole Han River basin. Furiously, the king of Baekje decided to attack Silla, but because the army was exhausted, Baekje lost the battle and the king himself died. Silla gained access to the Yellow Sea, which provided a gateway to communicate with China. This created conditions for the relationship between Silla and the Chinese dynasties to gradually tighten and by the 7th century, it became an alliance, threatening Goguryeo from both sides.

At the end of the 6th century, wars broke out between the Sui dynasty and Goguryeo. Sui dynasty launched a total of 4 invasions, in 598, 612, 613 and 614, but all were defeated. Notably, in 612, Emperor Yang of Sui mobilized an army of up to a million men to attack Goguryeo but failed miserably. The wars with Goguryeo severely weakened the Sui dynasty and further destabilized of the Sui dynasty government, hastening its collapse.

In 7th century, Emperor Taizong of Tang, after conquering the Eastern Turks in 630 and several small polities along the Silk Road in 640, started to turn his attention to Goguryeo. Goguryeo was no longer as powerful as it used to be, but it was still a major force in the region. Emperor Taizong had a personal ambition to defeat Goguryeo and was determined to succeed where Emperor Yang had failed.

Meanwhile, in Goguryeo, King Yeongnyu along with a number of courtiers planned to execute Yeon Gaesomun, one of the great nobles of Goguryeo, because Yeongnyu considered him a threat. However, the plot was foiled and Yeon Gaesomun killed the king along with opposing officials, then made Yeongnyu's nephew Bojang the new King of Goguryeo. From that point, Yeon Gaesomun held de facto control of Goguryeo through his puppet King Bojang.

In 642, King Uija of Baekje attacked Silla and captured around 40 strongpoints. In 643, Queen Seondeok of Silla requested aid from the Tang dynasty because her state was under attack by the Goguryeo–Baekje alliance. Emperor Taizong sent an official called Xiangli Xuanjiang (相里玄獎) to demand Goguryeo and Baekje cease their attacks on Silla, but Yeon Gaesomun refused.

Course


Emperor Taizong used Yeon Gaesomun's murder of the Goguryeo king as a pretext, and began preparations for an invasion in 644. On land, an army of 60,000 Tang soldiers and an unspecified number of tribal forces gathered at Youzhou (modern Beijing and surroundings) under the command of General Li Shiji in April 645. Emperor Taizong personally commanded 10,000 armored cavalry, and would join and reinforce Li Shiji's army during the expedition. At sea, a great fleet of 500 ships transported an additional 40,000 conscripted soldiers and 3,000 military gentlemen (volunteers from the elite of Chang'an and Luoyang) from the Liaodong Peninsula to the Korean Peninsula.

On 1 May, General Li Shiji's troops entered Goguryeo territory, crossed the Liao River farther north and surprised their opponents. On 16 May, they laid siege to Gaimou (Kaemo) Fortress and captured it in only 11 days, seizing 20,000 people and 100,000 shi (6 million liters) of grain. General Li Shiji then proceeded toward Liaodong (Yodong) Fortress and crushed a Goguryeo relief army of 40,000 troops. He was joined by Emperor Taizong and his armored cavalry a few days later. They together laid siege to Liaodong Fortress, capturing it too with surprising ease on 16 June with incendiary projectiles and favorable winds, allowing Tang troops to breach the fortress walls.

On 27 June, the Tang army arrived at Baiyan (Baekam) Fortress. On July 2, the Goguryeo commander surrendered the fortress to Tang. Emperor Taizong ordered that the city must not be looted and its citizens must not be enslaved.

On 18 July, the Tang army arrived outside Ansi Fortress. Emperor Taizong was alerted to a large relief army, consisting of Koreans and Malgal, and totaling 150,000 troops. He sent General Li Shiji with 15,000 troops to lure the Goguryeo forces, while another Tang force commanded by Zhangsun Wuji and other generals 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 surrendered the very 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.

Despite the victory, the Tang army could not breach the Ansi Fortress, which was defended by the forces of Yang Manchun. Tang troops attacked the fortress as many as six or seven times per day, but the defenders repulsed them each time. As days and weeks passed, Emperor Taizong several times considered abandoning the siege of Ansi to advance deeper into Goguryeo, but Ansi was deemed to pose too great of a threat to abandon during the expedition. Eventually, Tang staked everything on the construction of a huge mound, but it was captured and successfully held by the defenders despite three days of frantic assaults by Tang troops.

Goguryeo forces managed to hold the fort for months. In addition, because the battle was fought in the Liaodong province, winter approached as early as October. Exacerbated by worsened conditions for the Tang army due to the weather getting considerably colder with winter approaching and diminishing provisions, Emperor Taizong was compelled to order a withdrawal from Goguryeo on 13 October, but left behind an extravagant gift for the commander of Ansi Fortress. Tang Taizong's retreat was difficult and many of his soldiers died as they were hit by a snowstorm. Taizong himself tended to the injuries of the Turkic generals Qibi Heli and Ashina Simo, who were both wounded during the campaign against Goguryeo.

Aftermath
In 645, Emperor Taizong founded the Minzhong Temple, the oldest temple in Beijing, to commemorate his soldiers who died in Goguryeo.

In 647, after normalizing relations, Emperor Taizong once again severed ties with Goguryeo and prepared 30,000 troops for an expedition. This time he ordered to launch small-scale attacks on Goguryeo in order to weaken the kingdom. Some Tang officials advised that, for such an expedition, one year's food reserves were needed and more warships had to be built. Since the Jiannan Circuit had not been involved in the war before, Tang officials suggested building ships in that area. The Emperor agreed and sent Qiang Wei to build them. However, it became apparent that the people of the Jiannan Circuit were not capable ship builders, so it was only responsible for supplying timber.

In 649, Emperor Taizong died. Before his death, he ordered the campaign to be canceled. After Tang Gaozong ascended the throne, Tang launched a series of wars against Goguryeo and Baekje. In 660, the coalition of Tang and Silla destroyed Baekje. In 666, Yeon Gaesomun died and Goguryeo's power severely weakened due to succession crisis. The Tang–Silla alliance mounted a fresh invasion of Goguryeo in 667, aided by the defector Yeon Namsaeng, and in 668, finally vanquished the divided kingdom, which had been plagued by violent dissension, numerous defections, and widespread demoralization following the death of Yeon Gaesomun.