Following a disastrous bid to conquer the southlands, Shi Le, through the advice of
Zhang Bin, brought his followers to establish a capital at the city of
Xiangguo, ending his years of leading a roving army. His new base was in close proximity to two of his rival warlords from the Western Jin; the Inspector of
Bing province,
Liu Kun and the Inspector of
You province,
Wang Jun. Soon after occupying Xiangguo, Zhang Bin warned his lord to anticipate an attack from either one of the two men, and that he should begin fortifying the city and stockpiling his grains. Shi Le did so by sending out his generals to attack Ji province, where many of the local forts and ramparts submitted to him and allowed him to transport their grains to Xiangguo. At the time, Wang Jun was one the most powerful Jin vassals remaining in northern China, partly due to his alliances with the
Duan-
Xianbei and
Wuhuan tribes who provided him with elite cavalry units. Shi Le was unable to overcome his forces at first, losing to him on four separate occasions between 308 and 310. Wang Jun maintained strong ties with the Duan, marrying his daughter to their chieftain,
Duan Wuwuchen and successfully petitioning the court to grant them a dukely fief over
Liaoxi Commandery. After the fall of
Luoyang and the capture of
Emperor Huai of Jin, his influence was so immense that he began having ambitions to claim the imperial throne for himself. In December 312, two natives of
Guangping Commandery,
Zhang Chai and You Lun (游綸), brought severals thousands people to occupy the city of Yuanxiang (苑鄕, in present-day
Hebei and
Beijing), where they submitted to Wang Jun. Shi Le sent seven of his generals, including
Kui An and
Zhi Xiong, to attack them, and they were able to break through the outer walls. == The battle ==