Mobilized local gentry and Sogdian merchants to take Guzang, assuming the title King of Liang.

Li Gui (李轨)
李轨
Li Gui (李轨, died 619), courtesy name Chuze, was a prominent regional hegemon during the transition from Sui to Tang and the founding monarch of the Daliang regime in the Hexi Corridor. Originating from a wealthy gentry clan in Guzang, Wuwei, Li Gui was recognized for his literary education, persuasive intellect, and local generosity. In 617, as warlord Xue Ju ravaged the northwest, Li Gui led a successful local uprising…
PROFILE
Li Gui (李轨, died 619), courtesy name Chuze, was a prominent regional hegemon during the transition from Sui to Tang and the founding monarch of the Daliang regime in the Hexi Corridor. Originating from a wealthy gentry clan in Guzang, Wuwei, Li Gui was recognized for his literary education, persuasive intellect, and local generosity. In 617, as warlord Xue Ju ravaged the northwest, Li Gui led a successful local uprising alongside regional elites, seizing Guzang, proclaiming himself King of Liang, and preserving administrative continuity under former Sui statutes. By repelling Xue Ju's incursions and releasing thousands of captives, Li Gui quickly consolidated control over five commanderies across Hexi. Following the founding of the Tang dynasty in 618, Emperor Gaozu (Li Yuan) sought an alliance, addressing Li Gui as a younger cousin and conferring the title King of Liang. Encouraged by his ministers, Li Gui refused subordinate vassalage, declaring himself Emperor of Daliang with the reign title Anle. However, his regime deteriorated as he poisoned his primary strategist Liang Shuo under false pretenses, wasted state revenues on occult towers for mythical celestial spirits, and refused grain relief during a catastrophic famine. In 619, Tang covert agent An Xinggui organized a palace mutiny alongside Sogdian forces; Li Gui was captured and escorted to Chang'an, where he was executed.
- Courtesy Name
- Chuze (处则)
- Reign Title
- Anle (安乐)
- Native Place
- Guzang, Wuwei (present-day Wuwei, Gansu)
- Date of Death
- 619 (Tang, 2nd year of Wude)
- Dynasty
- Sui-Tang Transition (Daliang Regime)
- Highest Official Position & Nobility
- Emperor of Daliang (大凉皇帝), King of Liang (凉王), Area Commander-in-chief of Liangzhou (凉州总管)
- Identity
- Regional Warlord of the Sui-Tang Transition, Founding Sovereign of the Daliang Regime
LIFE TIMELINE
Crushed Xue Ju's forces at Changsong, expanded across Hexi from Zhangye to Dunhuang.
Rejected Tang vassalage, enthroning himself as Emperor of Daliang with the reign title Anle.
Poisoned chief advisor Liang Shuo, constructed the Jade Maiden Tower, and closed granaries amidst famine.
Captured in a military coup orchestrated by the An brothers; executed in Chang'an, extinguishing the Daliang state.
Relationship graph
BIOGRAPHY
Life and Career
Frontier Prominence and the Guzang Uprising
Li Gui was born into an affluent merchant and landholding family in Guzang, Wuwei Commandery. Endowed with a keen intellect and familiarity with historical records, he gained widespread admiration on the frontier for his generous financial relief toward impoverished townsfolk. During the Daye era of Emperor Yang of Sui, he held office as an administrative officer in the local imperial garrison.
In 617, as the Sui dynasty collapsed into anarchy, warlord Xue Ju proclaimed himself emperor in Jincheng, dispatching cavalry to pillage neighboring commanderies. Convinced that Sui local officials were too feeble to protect the frontier, Li Gui convened local gentry leaders—including Guan Jin, Liang Shuo, Li Yun, and the influential Sogdian merchant chief An Xiuren—to plot an armed takeover for mutual preservation. Scribe Cao Zhen cited ancient prophetic verses declaring that a member of the Li clan was destined to rule the empire, prompting the assembly to elect Li Gui as supreme leader.
In the seventh month of that year, An Xiuren led a body of foreign troops to breach the inner palace at night. Li Gui marshaled the townsfolk in coordination, arresting Sui commander Xie Tongshi and assistant governor Wei Shizheng. Declaring himself King of Great Liang, Li Gui established an autonomous administration adhering to early Sui statutes, quickly securing the submission of regional nomadic chieftains.
Benevolent Policies and Hexi Hegemony
Following the coup, regional magnates urged Li Gui to execute all former Sui magistrates and divide their private fortunes. Li Gui forcefully condemned the proposal, declaring that their righteous enterprise sought to restore order rather than commit banditry. He appointed the captured Sui officials Xie Tongshi and Wei Shizheng to high ministerial offices, winning the profound gratitude and loyalty of administrative elites.
When Xue Ju dispatched an invading column into Liangzhou, Li Gui's forces met the enemy at Changsong, slaying two thousand soldiers and capturing the remainder. When his generals urged the mass execution of the prisoners of war, Li Gui released them without harm, reasoning that if heaven favored his cause, these soldiers would naturally become his subjects. Following this victory, Li Gui launched westward expeditions, capturing Zhangye, Jiuquan, Dunhuang, Xiping, and Fuhan, establishing undisputed supremacy across the entire Hexi Corridor.
Sovereign Assertion and Tang Confrontation
In the fifth month of 618, Li Yuan established the Tang dynasty in Chang'an. Seeking to secure his northwestern flank against Xue Ju, Li Yuan dispatched imperial letters to Guzang, addressing Li Gui as a younger paternal cousin and proposing friendly ties. Highly pleased, Li Gui dispatched his brother Li Mao to Chang'an. In return, Li Yuan appointed Li Mao general and sent court envoy Zhang Side bearing credentials to invest Li Gui as King of Liang and Area Commander-in-chief of Liangzhou.
Before the envoy reached Guzang, Li Gui's political ambitions had expanded under the flattery of his court. In the winter of 618, he proclaimed himself Emperor of Daliang, established the reign era Anle, named his son Li Boyu crown prince, and promoted Cao Zhen to Left Vice Director of the Department of State Affairs.
Upon Zhang Side's arrival, Li Gui discussed renouncing imperial dignity to accept Tang vassalage. Cao Zhen vigorously opposed submission, arguing that in a fractured realm where rival monarchs competed across China, Daliang possessed sufficient territorial strength to stand as an independent empire on par with the Tang. Persuaded, Li Gui sent an envoy to Chang'an with a state letter addressing Li Yuan as "Your Younger Cousin, the Emperor of Great Liang." Infuriated by this diplomatic defiance, Li Yuan imprisoned the envoy, severing relations between the two regimes.
Slaying the Chief Counselor and Religious Folly
Following his enthronement, Li Gui relied upon veteran strategist Liang Shuo as his chief minister. Liang Shuo, a strict and discerning administrator, recognized the growing military influence of the resident Sogdian population and cautioned Li Gui against foreign usurpation, inciting deep hostility from Sogdian official An Xiuren. When Li Gui's second son Li Zhongyan visited Liang Shuo and was treated without special ceremony, he conspired with An Xiuren to fabricate charges of treason against Liang Shuo. Blinded by prejudice, Li Gui secretly administered poison to Liang Shuo in his private home. The sudden murder of their foremost strategist alienated long-standing veterans and fatally eroded internal cohesion.
Around this time, a local sorceress fabricated a prophecy claiming that the Supreme Deity would dispatch a celestial Jade Maiden to visit the emperor. Enamored by the superstition, Li Gui mobilized vast labor drafts and depleted the treasury to erect the towering Jade Maiden Platform. Soon afterward, an acute drought struck Hexi, reducing the populace to cannibalism. When Cao Zhen urged the distribution of public reserves, former Sui officials seeking to undermine the regime falsely claimed that storehouses must be preserved for future military emergencies. Li Gui closed the granaries, triggering widespread despair and defections among soldiers and civilians.
An Family Coup and Capital Execution
In Chang'an, An Xiuren's elder brother An Xinggui petitioned Emperor Gaozu for permission to travel to Liangzhou to induce Li Gui's capitulation. Arriving in Guzang, An Xinggui was appointed general by Li Gui. An Xinggui urged him to submit his realm to Tang authority like Dou Rong had done under the Eastern Han, warning that Hexi lacked natural barriers against imperial power. Li Gui stubbornly refused, boasting that if King of Wu Liu Pi could style himself Eastern Emperor in antiquity, he could easily rule as Western Emperor.
Realizing that diplomacy had failed, An Xinggui secretly mobilized his brother An Xiuren, resident foreign cavalry, and disgruntled former Sui levies to launch a surprise midnight assault on Guzang. Li Gui led a desperate sortie with a thousand palace guards but was forced to retreat into the inner citadel. An Xinggui proclaimed from the walls that those resisting the imperial army would face clan extermination, causing Li Gui's defenders to throw down their weapons.
Weeping over his abandonment, Li Gui ascended the Jade Maiden Platform with his wives and children to drink a final cup of farewell. He was captured by An Xiuren and escorted in chains to Chang'an. In the fifth month of 619, Li Gui and his sons were publicly executed in the marketplace, bringing a sudden end to the three-year Daliang regime.
Personal Relationships
- Brother: Li Mao, sent as envoy to Chang'an and appointed general by Tang.
- Sons: Li Boyu (Crown Prince) and Li Zhongyan, whose false slanders caused Liang Shuo's execution.
- Chief Advisor Executed: Liang Shuo, primary strategist poisoned by Li Gui.
- Court Promoter: Cao Zhen, Left Vice Director who persuaded Li Gui to declare imperial status.
- Subversive Coup Leaders: An Xinggui and An Xiuren, brothers who orchestrated the mutiny that overthrew Li Gui.
- Tang Sovereign: Li Yuan (Emperor Gaozu of Tang), who initially courted Li Gui as a cousin before ordering his execution.
Historical Assessment
- Old Book of Tang: "Li Gui seized authority in Hexi, protected Sui officials without seizing their wealth, and released enemy captives, which accounted for his rise. Yet he murdered his chief counselor and indulged in sorcery, ensuring his swift and deserved destruction."
- New Book of Tang: "He possessed literacy and persuasive eloquence, his family dominating the frontier with immense wealth... Yet his intellect was insufficient for his vast ambitions; murdering loyal ministers while infatuated with occult spirits, his ruin was inevitable."
Related Entries
- Daliang Regime
- Transition from Sui to Tang
- Xue Ju
- Li Yuan
- An Xinggui
- Dou Rong
FIGURES ASSOCIATED WITH THIS DYNASTY
Bibliography
- Liu Xu et al., Old Book of Tang (Jiu Tang Shu), Volume 55, "Biography of Li Gui."
- Ouyang Xiu, Song Qi et al., New Book of Tang (Xin Tang Shu), Volume 86, "Biography of Li Gui."
- Sima Guang, Comprehensive Mirror for Aid in Government (Zizhi Tongjian), Volumes 184–187, "Sui and Tang Annals."