Anyin Sha of the Yelü clan was a Khitan general and statesman in ancient China'sLiao Dynasty. He rose to the position of the chancellor of the southern government during Emperor Muzong of Liao's reign. When Emperor Jingzong assumed power in 969, Yelü Sha was tasked to command the army on Liao's southern border for possible war against the Song Dynasty. In 976, the Song army attackedNorthern Han, a small kingdom wedged between Song and Liao, and Yelü Sha took the Liao troops to assist Northern Han until the Song army withdrew. He was promoted when he presented the Song prisoners to Emperor Jingzong. In 977, Song invaded Northern Han again, and Liao army under the overall command of Yelü Sha went to assist Northern Han, meeting the Song army across a river at Baimaling. The vanguard general Yelü Dilie, Emperor Jingzong's cousin, went against Yelü Sha's advice to attempt cross the river without waiting for the main Liao army. His army was annihilated in the river, and Yelü Dilie was among the five Liao generalsslain, which also include Yelü Sha's son Yelü Deli. Only after the arrival of general Yelü Xiezhen's reinforcement did the Song attacks stop. Soon afterwards, just as Yelü Sha prepared to advance to Northern Han's capital of Taiyuan, news of the fall of Northern Han arrived. Immediately after conquering Northern Han, the Song army went northward to attack Liao. Yelü Sha resisted the Song army, and with the help of generals Yelü Xiezhen and Yelü Xiuge, defeated the Song army at the battle of Gaoliang River. The following year, Yelü Sha followed Han Kuangsi to invade Song, and their army was annihilated. Furious, Emperor Jingzong wanted to execute both, but his wifeXiao Chuo pleaded on their behalves, eventually reducing their sentences to flogging. After the death of Emperor Jingzong, his widow Xiao Chuo effectively ruled Liao. In 987 Yelü Sha participated in another invasion of Song, this time defeating the resistant Song army, and was awarded as a result.