Tibetan attack on Songzhou
The first military conflict between China and Tibet occurred in 638. In the early 7th century, the westward conquests of the Chinese Tang dynasty brought it into contact with the rising Tibetan Empire. When Emperor Taizong of Tang refused a marriage alliance, the Tibetan emperor Songtsen Gampo sent an army to attack the Chinese frontier city of Songzhou. After a Tang army inflicted heavy casualties on the Tibetans in a night-time attack, Songtsen Gampo withdrew. He sent emissaries and tributes to Chang'an to apologize, and to again request marriage. Taizong decided to give Songtsen Gampo a distant niece, Princess Wencheng, in marriage. The peace held for the remainder of the reigns of Taizong and Songtsen Gampo, although Tibet would pose major military threats for most of the rest of the Tang period.
Initial contacts between Tang and Tibet
During the early decades of the 7th century, the major threat to the west of China was the Xianbei state of Tuyuhun. Thereafter, Tuyuhun's southwestern neighbor, the Tibetan Empire, rose in power.The existence of Tibet was unknown to the Chinese until 608, when Tibetan emissaries from Emperor Namri Songtsen arrived with tribute to Sui China. In 634, his son Songtsen Gampo sent tribute and a request for a heqin. In the interim, a North China aristocrat had defeated the Sui and declared himself Emperor Gaozu of Tang. When Songtsen Gampo's marriage overture arrived, Taizong, the second Tang emperor, was battling the Tuyuhun and did not initially respond, but did send the emissary Feng Dexia to Tibet to establish peaceful relations.
Conflict in 638
Meanwhile, in late 634, Taizong had sent the general Li Jing against Tuyuhun and, in a major campaign, overpowered Tuyuhun's Busabo Khan Murong Fuyun, who was killed in flight. The Tang thereafter appointed Murong Fuyun's son Murong Shun as Tuyuhun's khan and, after Murong Shun was assassinated late in 635, supported Murong Shun's son Murong Nuohebo as khan.Feng Dexia appeared to have arrived to Tibet around the same time. By then, Songtsen Gampo was aware that, in the past, the khans of the Eastern Turkic Khaganate and Tuyuhun had arranged marriages of state with China and therefore sent an emissary to accompany Feng back to Tang with further tribute to request to marry a Tang princess.
Taizong turned the proposal down. When the Tibetan emissary returned to Tibet, he informed Songtsen Gampo, falsely according to Tibetan historical sources, that Taizong was disposed to approve a dynastic marriage but changed his mind after hearing the Tibetans slandered by the Tuyuhun. It was said that Murong Nuohebo had visited Tang and was interfering, leading to Taizong's refusal. Songtsen Gampo, believing the report, attacked Tuyuhun in late 637 and early 638, capturing some of them and forcing the rest to flee north of Qinghai Lake.
In the fall of 638, Tibetan forces, apparently commanded by Songtsen Gampo himself, then raided the Tang frontier city of Songzhou, but meanwhile sending emissaries to the Tang capital Chang'an, again offering tributes and declaring that they were intending to welcome a princess. The size of his army is given as 100,000 by Tibetan sources and over 200,000 by Chinese sources.
They defeated a force sent against them by the Songzhou governor Han Wei. According to the Chinese annals, Taizong responded by commissioning the general Hou Junji to command an army, assisted by the generals Zhishi Sili, Niu Jinda and Liu Jian. Led by Niu, the Tang army inflicted heavy casualties on the Tibetans in a surprise night-time attack. Alarmed, Songtsen Gampo withdrew, sent emissaries and tributes to Chang'an to apologize and to again request marriage. Emperor Taizong agreed this time.
Marriage between Songtsen Gampo and Princess Wencheng
However, no further action was taken to carry out the marriage for about two years. In fall 640, Songtsen Gampo sent his prime minister Gar Tongtsen Yülsung to Tang to offer tributes of gold and jewels, again requesting marriage. In response, Taizong created a daughter of a kinsman, Princess Wencheng, preparing to give her to Songtsen Gampo in marriage. Impressed by Gar Tongtsen Yülsung's propriety in interacting with him, he also, over Gar Tongtsen Yülsung's own objection—that he already had a wife and that it would be inappropriate for him to marry before his king—gave Lady Duan, the granddaughter of Princess Langye, to Gar Tongtsen Yülsung as a wife as well.In spring 641, Taizong sent his cousin, Li Daozong, Prince of Jiangxia, to accompany Gar Tongtsen Yülsung back to Tibet and to escort Wencheng. When they arrived in Tibet, Songtsen Gampo was said to be so pleased that he bowed to Li Daozong, using ceremony appropriate for a son-in-law toward a father-in-law. He built a palace for Wencheng and changed into Chinese clothing before he met her. It was said that at that time, the Tibetan people had a custom that Princess Wencheng hated—that people would paint their faces red—and that he prohibited the custom for her sake.
Aftermath
As part of the agreement, he also sent nobles and family members to Chang'an to study at Tang's imperial university, in an old custom which made them de facto hostages, while they learned Chinese customs and culture for better relationship. Songtsen Gampo also requested Chinese scholars. Early in Gaozong's reign, Tibet also requested technology transfers for sericulture, winemaking, gristmills and papermaking.The marriage alliance began two decades of peace between the two empires. In 647, for when Taizong sent a force under the command of the Göktürk prince Ashina Shö-eul on a punitive expedition against the state of Kucha under its new king Hari Pushpa, after his predecessor had refused to pay tribute in protest at China's interventionist policy, Tibetan troops were requisitioned. Moreover, in 648, when the Tang emissary Wang Xuance became stuck in political turmoil of an Indian state, he sought aid from both Tibet and Nepal and was assisted by both in defeating one of the factions in 649.
During this period, the Tibetans strengthened and expanded their empire. By the late 660s they had overrun the Tuyuhun, and were in direct contact with Tang territory. The two empires fought sporadically over the following decades, and much of North western China fell to the Tibetan hands. With the weakening of Chinese power consequent on the An Lushan Rebellion, the Tibetans managed to recapture vast swathes of their lost territory, overrunning Songzhou and the surrounding area in 763, and even briefly capturing the capital Chang'an. Songzhou was thereafter reportedly settled by Tibetans from Ngari and identified in Tibetan geographical writings as part of the expanding Tibetan empire, classified variously as part of Amdo or Kham. Sharkok and neighboring Khöpokok remain Tibetan-speaking areas to this day.
The effect of the resurgence of the Tibetan Empire was to facilitate the proselytization of Buddhism north and westwards, to the detriment of the expansion of Islam. It was a decisive factor in the rerouting of China's silk commerce and East-West trade patterns, which shifted northwards through Uighur lands.