Xue Ju (薛舉) (died 618), formally Emperor Wu (武皇帝, "Martial"), was the founding emperor of a short-lived state of Qin at the end of the Chinese Sui Dynasty, whose state was eventually destroyed by the Tang Dynasty. He rose against Sui rule in 617 and soon controlled modern eastern Gansu, but while he had some successes against Tang forces, was not able to push toward the Tang capital Chang'an before dying of illness in 618. His son Xue Rengao inherited his throne but was soon defeated and killed by the Tang general Li Shimin, ending the state that Xue Ju established.
 Xue Ju's clan was originally from Hedong Commandery (河東, roughly modern Yuncheng, Shanxi), but his father Xue Wang (薛汪) moved the family to Jincheng (金城, in modern Lanzhou, Gansu).  Xue Ju was said to be brave and strong, and because his family was wealthy, he was able to use the wealth to establish relationships with other people, making himself an influential member of the gentry, eventually becoming a commander of the local militia.
 In 617, there were many agrarian rebellions in modern eastern Gansu. Hao Yuan (郝瑗), the county magistrate of Jincheng, thus invited people to join the military, and he gathered several thousand men and gave them to Xue Ju to command.  in summer 617, after Hao distributed armor and weapons to the soldiers and set out a feast to send them off, Xue Ju, his oldest son Xue Rengao, and 13 other cohorts took Hao captive and announced that they were rebelling against Sui Dynasty.  Xue Ju arrested the local officials and opened the food storages to aid those who were poor. He claimed the title of "Hegemonic Prince of Western Qin" (西秦霸王), perhaps echoing Xiang Yu's title of "Hegemonic Prince of Western Chu."  To signify a break with Sui, he also changed the era name from Emperor Yang of Sui's Daye (大业) to Qinxing (秦興).  He created Xue Rengao the Duke of Qi and a younger son, Xue Renyue (薛仁越) the Duke of Jin. He also gathered the local agrarian rebels to fall under his command in pillaging the Sui governmental grazing ranches. One of those rebel leaders, Zong Luohou (宗羅睺) became a key general for Xue Ju, and Xue Ju created him the Duke of Yixing. Soon, much of the territory in modern eastern Gansu had surrendered to Xue Ju.  He promoted Xue Rengao, Xue Renyue, and Zong to princes.
 In fall 617, Xue Ju claimed the title of Emperor of Qin. He created his wife Lady Ju empress, and he created Xue Rengao crown prince.  Xue Rengao subsequently captured Tianshui, and Xue Ju moved his capital to Tianshui. As Xue Rengao was fierce but often overly cruel to those he captured, Xue Ju often warned him, "You are capable of great things, but you are strict and cruel, with no grace to others.  One day you will surely destroy the state I established and our clan." According to traditional historical accounts, however, Xue Ju himself was also cruel, often killing soldiers he captured, and also often cut off their tongues and noses, and therefore did not gain as much following as he hoped.  When he sent Xue Renyue south to try to capture lands in modern Sichuan, Xue Renyue was blocked by Xiao Yu the governor of Hechi Commandery (河池, in modern Baoji, Shaanxi) and unable to advance.  He also sent his general Chang Zhongxing (常仲興) west of the Yellow River to attack Li Gui, who had by then seized the territory west of the Yellow River.  Chang, however, was defeated by Li Gui's general Li Yun (李贇), and the entire army was captured by Li Gui, although Li Gui released them back to Xue Ju.
 Around the new year 618, Xue Ju sent Xue Rengao to attack Fufeng Commandery (扶風, also in modern Baoji), but Xue Rengao was blocked by the rebel leaders Li Hongzhi (李弘芝), who had claimed the title of Emperor of Chu, and Tang Bi (唐弼), who had claimed the title of Prince of Tang under Li.  Xue Ju sent messengers to persuade Tang to submit, and Tang killed Li and then offered to surrender.  Instead, Xue Rengao attacked Tang and seized his troops.  Xue Ju then proceeded himself to Fufeng, intending to next attack the Sui capital Chang'an, which had been captured by the Sui general Li Yuan, who declared Emperor Yang's grandson Yang You the Prince of Dai emperor (as Emperor Gong).  Li Yuan sent his son Li Shimin against Xue Rengao, and Li Shimin dealt Xue Rengao a major defeat.  Xue Ju, in fear, asked his officials, "Since ancient times, were there emperors who surrendered?"  Chu Liang (褚亮) cited the examples of Zhao Tuo, Liu Shan, and Xiao Cong.  However, Hao Yuan, by this point serving under Xue Ju, immediately stated:
 Xue Ju saw the fallacy in asking the question, and he greatly rewarded Hao and made Hao his chief strategist. Subsequently, when Li Yuan sent his generals Jiang Mo (姜謨), Dou Gui (竇軌), and Liu Shirang (劉世讓) against Xue Ju, Xue Ju defeated them and captured Liu, and Jiang and Dou withdrew. Subsequently, under Hao's suggestion, Xue sought to enter a three-way alliance with Eastern Tujue's forces and those of another rebel leader, Liang Shidu the Emperor of Liang, to try to capture Chang'an. However, Li Yuan's general Zhang Changsun (張長遜) then warned the Tujue general Ashina Duobi that he was aware of their three-way pact, and Ashina Duobi chose to renege and not assist either Xue Ju or Liang.  (Soon, after hearing that Emperor Yang had been killed in a coup led by Yuwen Huaji in Jiangdu (江都, in modern Yangzhou, Jiangsu), Li Yuan had Yang You yield the throne to him, establishing Tang Dynasty as its Emperor Gaozu.)
 In summer 618, Xue Ju launched an attack on Tang's Jing Prefecture (涇州, roughly modern Pingliang, Gansu), and Tang's Emperor Gaozu sent Li Shimin to resist Xue Ju.  Li Shimin established his defenses and refused to engage Xue Ju to try to wear Xue Ju out, but at that time, he was afflicted with malaria, and he let his associates Liu Wenjing and Yin Kaishan (殷開山) take command, ordering them not to engage Xue Ju.  Liu and Yin, however, did not take Xue Ju seriously, and Xue Ju ambushed them at Qianshui Plain (淺水原, in modern Xianyang, Shaanxi), crushing Tang forces and inflicting 50%-60% casualties. Li Shimin was forced to withdraw back to Chang'an, and Liu and Yin were removed from their posts.  Hao then suggested to Xue Ju that he should attack Chang'an at once, and Xue Ju agreed, but he then grew ill and died. Xue Rengao succeeded him as emperor and honored him with the posthumous name of Wu (武, "martial"), but was defeated by and forced to surrender to Li Shimin three months later, even before he could properly bury Xue Ju.