 In 361 BC, Duke Xiao of Qin ascended as the ruler of Qin, and appointed Wei Yang in 359 BC, who enacted a series of legalist reforms that greatly strengthened the state of Qin.In 332 BC, King Huiwen of Qin dispatched Gongsun Yan (公孫衍) to attack Wei, killing 80,000 enemies and capturing Xihe Commandery (西河郡) and Shang Commandery (上郡).At the time, Yiqu was having domestic disputes, so the Qin army, with its morale boosted by the recent victories, invaded Yiqu under the pretext of helping to quell Yiqu's chaos.