临洮县
Around 255, the Shu general Jiang Wei led forces to attack Wei and besieged Wang Jing, the Inspector of Yong Province, in Didao (狄道; southwest of present-day Lintao County, Gansu). The Wei imperial court appointed Deng Ai as General Who Stabilises the West () and Colonel Who Protects the Eastern Qiang () to lead troops to lift the siege. By then, Jiang Wei had withdrawn to Zhongti (鍾提; south of present-day Lintao County, Gansu), so many of Deng Ai's subordinates thought that Jiang Wei was exhausted and would not attack Didao again. However, Deng Ai held a different opinion and he said: As Deng Ai predicted, Jiang Wei led his forces to attack Mount Qi later but were repelled by the defences set up by Deng. Jiang Wei retreated to Dong Village (董亭; south of present-day Wushan County, Gansu), while Deng Ai stationed his troops at Mount Wucheng (). Jiang Wei tried to seize control of the mountainous terrain from Deng Ai, but was driven back. That night, Jiang Wei attempted to cross the Wei River to attack Shanggui (上邽; present-day Tianshui, Gansu). Deng Ai intercepted Jiang Wei at Duan Valley (段谷; southwest of present-day Tianshui, Gansu) and defeated him.