The reconstituted Tang Empire that emerged in the late eighth century was based on a social and economic foundation that once again facilitated the rise of great families. The “equal field” system was abandoned and restrictions on land ownership were abolished. Taxation was shifted from a per capita enumeration to calculations based on cultivated land. Wealthy local families came to occupy prominent administrative positions. Over the course of several decades, this led to increasing dissention within An Nam between leaders from Giao in the Red River plain who supported Tang authority and leaders from peripheral upland areas and in the southern provinces who were driven by other ambitions. What gave momentum to this developing confrontation was not only the rise of contending local powers but also the progressive weakening of Tang central government during the course of the ninth century. This was accompanied by the rise of new threats from beyond the frontiers. The peoples in the mountains were being stirred by the rise of the Nan Zhao kingdom in Yunnan, and on the southern coast the Chams were resurgent.
After the Phung Hung episode, Tang government in An Nam benefited from a series of astute protector generals who cultivated popular support for rebuilding government in the protectorate. The first of these, Zhao Chang, wrote a book about An Nam and earned a good reputation among the people in the Red River plain. He was in An Nam from 791 to 802 and was sent back a second time from 804 to 806. His protégé, Zhang Zhou, succeeded him from 806 to 810 and during that time organized an army to beat back the Chams who, during the time Zhao Chang had been absent from the protectorate, had seized the southern coastal provinces in alliance with local leaders there.
However, the situation turned grim in 820 when a military commander, whose ancestors had been administrators on the Cham frontier since the early eighth century, managed to seize Dai La and to kill the protector general along with a thousand members of his entourage. For the next sixteen years, the protectorate was rent with disorders; imperial officials struggled with local strongmen and frontier threats. The situation eased somewhat in the late 830s with the leader- ship of some capable protector generals, only to worsen again in the late 840s and early 850s as protectorate politics were superseded by the ascendance of Nan Zhao and its mobilization of peoples in the mountains for a policy of raiding and plundering the lowlands of An Nam.
Despite the chronic raiding, trade in horses and salt continued between people in the uplands and lowlands. In 854, a seemingly inept protector general’s effort to gain control of this trade led to its breakdown and an escalation of hostilities. Do Ton Thanh, the governor of the Ma River plain, whose family had been prominent in the region since the fifth century, allied with Nan Zhao, whether in resistance to the protector general or in response to spreading disorder is unclear; he was seized and executed by the protector general, which stiffened resistance to Tang authority in the southern parts of the protectorate. Then, the protector general neglected, whether by bungling, by the manipulations of local officials, or by lack of resources is unclear, to reinforce the garrison at the head of the Red River plain during the dry season when raiders habitually burst from the moun- tains. The commander of the garrison, caught in a hopeless situation, shifted his allegiance to Nan Zhao. Such are the main events cited in historical records for the outbreak of a war that devastated An Nam during the next decade. Imperial historiography assigned blame for this war to the hapless protector general at that time, a shadowy figure named Li Zhuo, of whom virtually no information has survived. While a more capable man may have been able to master the situation, this war was about much more than one man’s mistakes. It had been brewing for decades. Not simply a problem of frontier security, it had to do with local politics in the protectorate and how to respond to the decline in Tang power.
The people of An Nam experienced imperial rule differently, depending upon terrain and upon proximity to centers of government. Agriculturalists in the Red River plain were most directly affected by Sinic civilization. They understood themselves as members of the civilized world that relied upon the Tang shield for protection against the barbaric forces of disorder that threatened them. The inhabitants of provinces in the southern plains of the Ma and Ca Rivers were vulnerable to and less hostile toward neighboring peoples in the mountains and on the southern coast who lived beyond the imperial order; they could relate to these peoples as potential allies in times when northern dynastic power was too weak to maintain order in their lands.
The rising prestige of Nan Zhao, combined with the ebbing of Tang strength on the southern frontier, posed a problem for leaders in the southern provinces. They considered that it was time to take affairs into their own hands. Nan Zhao was breaking Tang’s grip on the region, but they aspired to be the ones who would benefit by eventually extending their power over the population of the Red River plain. Nan Zhao, with its center far away through the mountains in Yunnan, could plunder the lowlands and destabilize the imperial regime, but it was not capable of governing the agriculturalists of An Nam, which was the ambition of leaders in the southern provinces. Thus, we see in this war a theme that would reappear more than once during the course of later Vietnamese history: competition for dominance between the provinces in the Red River plain and the provinces in the plains of the Ma and Ca Rivers.
After the collapse of the Red River border garrison in 854, Tang armies were mobilized into An Nam, but turmoil in neighboring jurisdictions to the north distracted Tang attention. By 858, a local military commander, of whom nothing is known, had pushed aside the protector general. But shortly after, a competent general from the north arrived with Tang reinforcements, and, for two years, until his departure, he built new fortifications to protect Dai La, prevented Nan Zhao forces from entering the lowlands, and restored stable administration among the agriculturalists in the Red River plain. However, in 861, within a year of his departure, the family of Do Ton Thanh, the southern governor whom Li Zhuo had executed in 854 for negotiating with Nan Zhao, mobilized an army in league with Nan Zhao and captured Dai La while Tang forces were tied down in the mountains further north. Tang reinforcements soon arrived and restored a semblance of order as imperial officials endeavored to calm the protectorate by placating the Do family with apologies for Do Ton Thanh’s death.
This policy of conciliation failed, however, as the Tang weakness it was meant to conceal was unmasked by a full-scale Nan Zhao invasion in early 862. Tang armies fought until early 863, when Dai La fell and large numbers of Tang soldiers drowned trying to escape across the Red River. Tang forces in An Nam were utterly defeated. Nan Zhao plundered the Red River plain without hindrance as a multitude of refugees fled north and tens of thousands of perished soldiers were mourned in the towns and villages of central China where they had been recruited, provoking one Mencian scholar at the Tang court to write a song blaming the disaster on bad government and criticizing the empire’s waste of human life, thereby knowingly ruining his own career in officialdom.
It took two years for Tang to organize a military response to the defeat of 863. The population of An Nam was scattered by marauding bands from the moun- tains, and a large refugee population accumulated just over the northern border where Tang armies assembled. Men from the southern provinces of the protect- orate occupied the administrative center at Dai Lai and allied with Nan Zhao, preparing to resist the expected Tang reaction. The Tang court considered the situation sufficiently dire as to require the skills of Gao Pian, one of the most famous generals in the empire, who had made his reputation fighting Turks on the northern frontier. In 865, after months of training and preparing his troops, he advanced into the protectorate, chased Nan Zhao contingents into the moun- tains, and besieged recalcitrant forces at Dai La, which he took by the end of the year, reportedly executing some thirty thousand men captured there.
The Tang Empire’s remarkable effort to recover An Nam at a time when imperial authority was moving rapidly toward a general collapse is an indication not only of the primacy of frontier security but also of how An Nam was considered an integral part of the dynastic inheritance. Young men from An Nam took the official examinations and served in officialdom all over the empire. One of them rose to be prime minister in the late eighth century and two of his essays have been preserved. Another wrote a poem that was collected by Tang anthologists. One governor general of An Nam, despite being forced to flee the protectorate by a mutiny in the 840s, felt so at home there that he later retired to a village east of Hanoi, thereby establishing a family that in later centuries produced many famous scholars at Vietnamese royal courts.
Gao Pian was himself quite taken with An Nam. He spent three years there before being called north to deal with more urgent problems. During that time, he supervised emergency shipments of food for the population. He rebuilt Dai La, restored and extended dikes and canals, and constructed roads, bridges, and public inns. He also removed rocks that impeded coastal shipping, researched geomantic features of the terrain, investigated existing popular spirit cults, patronized shrines and temples, and instigated the worship of new deities to buttress An Nam’s connection to the imperial supernatural realm. Furthermore, he wrote poems about An Nam propounding Confucian and Daoist ideas. Later Vietnamese scholars credited him with authoring the first book on local geog- raphy and several maps and geographical texts were subsequently attributed to him. Popular tales of his deeds entered Vietnamese lore and Vietnamese literati sang his praises into the nineteenth century. He was the hero of the people in the Red River plain, for he had restored to them their membership of the civilized world. In the early eleventh century, a ruler from the Red River plain explicitly cited his legacy for inspirational authority after wresting power from a regime based in the southern provinces.
When Gao Pian departed An Nam in 868, he left in charge one of his grandsons, Kao Xun, of whom nothing is known. In the 870s, Zeng Gun replaced Kao Xun. Zeng Gun had been Gao Pian’s most trusted assistant during the Nan Zhao War and remained in An Nam for fifteen years. He wrote a book about the Red River plain that no longer exists but was cited by Vietnamese scholars in later centuries. In 880, he left when the last Tang garrisons were withdrawn amidst spreading anarchy in the north. Thereafter, the people of the Red River plain were left to their own devices as a host of warlords began to carve up the empire. For the next half-century, a relatively stable and peaceful regime was led by the Khuc family. As for the southern provinces, Gao Pian had halted their separate political trajectory and subordinated them to the structure of power based in the Red River plain.