Under Xue Ju
As of 617, Xue Rengao's father Xue Ju was a commander of the local militia at Jincheng (金城, in modern Lanzhou, Gansu), when, in response to increasing agrarian rebel activities, Hao Yuan (郝瑗), the county magistrate of Jincheng, gathered several thousand men and had Xue Ju command them. In summer 617, as Hao held a feast to send the men off, Xue Ju, Xue Rengao (who was his father's oldest son), and 13 other cohorts took Hao captive and announced that they were rebelling against Sui Dynasty. Xue declared himself the "Hegemonic Prince of Western Qin" (西秦霸王), and he created Xue Rengao the Duke of Qi, and soon the Prince of Qi. With the major general Zong Luohou (name not in Unicode) the Prince of Xing as his assistant, Xue Rengao attacked nearby commanderies, bringing them under his father Xue Ju's rule. In fall 617, after Xue Ju claimed the title of Emperor of Qin, he created Xue Rengao crown prince. Xue Rengao soon captured Tianshui, and Xue Ju moved his capital to Tianshui.
Xue Rengao was said to be strong and capable at horseriding and archery, and his army respected him, believing that he was capable of standing up to 10,000 men on his own. However, he was also said to be greedy and cruel. For example, when he captured Yu Li (庾立), the son of the Sui official Yu Xin (庾信), angry that Yu Li dared to resist, he hung Yu on the fire and grilled him, and while doing so, cut his limbs off one by one and cut off his flesh to have his soldiers consume it. When he captured Tianshui, he gathered all the rich men and hung them upside down, pouring vinegar into their nostrils to force them to surrender their treasure. 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."
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. In the aftermaths of the defeat, Xue Ju even considered surrendering to Li Yuan, although he was dissuaded from the idea by Hao, who had become an official under him, and who after this incident became a chief strategist for Xue Ju. (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 Sui's Emperor Gong yield the throne to him, establishing Tang Dynasty as its Emperor Gaozu.)
In fall 618, after Xue Ju had a major victory over Li Shimin, forcing Li Shimin to withdraw back to the Tang capital Chang'an. 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.
Read more about this topic: Xue Rengao