Zhang Lu surrendered to Cao Cao after his defeat at the Battle of Yangping. Xiahou Yuan was appointed acting Protector-General () and was ordered to pacify Ba Commandery () with the aid of Zhang He and Xu Huang. Cao Cao later returned to Ye (in present-day Handan, Hebei) and left Xiahou Yuan and others behind to defend the newly conquered Hanzhong Commandery. Xiahou Yuan was appointed General Who Attacks the West ().