User:Ltn12345/sandbox2

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 his ally Silla and punish Generalissimo Yeon Gaesomun for killing 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, commanded by Yang Manchun, and withdrew after more than 60 days of battle and unsuccessful siege.

Background
In 642, Goguryeo had enjoyed nearly 700 years of independence since King Dongmyeong defeated 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, attacked the Han River basin region. Silla then betrayed Baekje, driving Baekje 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, providing a gateway to communicate with China.

At the end of the 6th century, wars between the Sui dynasty and Goguryeo. Sui dynasty launched a total of 4 invasions, in 598, 612, 613 and 614, but all were defeated. The wars with Goguryeo severely weakened the Sui dynasty, further destabilization of the Sui dynasty government, hastening its collapse. However, the wars also inflicted a devastating toll on the Goguryeo.

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 he considered him a threat. However, Yeon Gaesomun received news of the plot and killed the king along with opposing officials. 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, Silla's Queen Seondeok requested aid from Tang because her state was under attack by the Goguryeo–Baekje alliance. Emperor Taizong sent the official 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 the pretext, and began preparations for an invasion in 644. On land, an army of 60,000 Tang soldiers plus an unspecified number of tribal forces gathered at Youzhou, and departed from Yincheng (present-day Chaoyang) 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, crossing the Liao River farther north and surprising their opponents. On 16 May, they laid siege to Gaimou (Kaemo) Fortress, capturing it in only 11 days, and 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, and 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. However, 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 notified of the approach of 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 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 the Ansi Fortress, 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. Furthermore, exacerbated by worsened conditions for the Tang army due to cold weather (and 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. 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 647, Emperor Taizong, after normalizing relations, 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 country. Some Tang officials advised that, for such an expedition, one year's food reserves were needed and more warships need to be built. Since Jiannan Circuit had not been involved in the war before, Tang officials suggested building ships in this area. Emperor agrees and sent Qiang Wei there to build ships. However, people soon realized that the people of Jiannan Circuit were not good at building ships, so it was only responsible for supplying timber for building ships in the end.

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, Goguryeo's power severely weakened due to internal strife. 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.