During the period of Five Dynasties, Zhangjiakou area, like other places in northern China, underwent repeated changes of rules of different dynasties. In 937, in order to enlist the help from Khitan people to defeat Later Tang, Shi Jingtang of Later Jin (Five Dynasties) agreed to cede Sixteen Prefectures to Khitan, later Liao Dynasty, in which Xinzhou (, present Zhuolu), Weizhou (, Huailai), Wuzhou (), Yuzhou () were included. The Sixteen Prefectures held strategic locations in the north and because the Great Wall was across Zhangjiakou area, the cession left China in a vulnerable position against the invasions from the north. In 951, Yelu Ruan, the Emperor Shizong of Liao intended to attack Later Zhou in the south despite the reluctance of many subordinate tribes. While passing Huoshendian (), the west of Xinzhou, a rebellion broke out and Yelu Gecha () and Yelu Pendu () assassinated the drunken emperor. The rebellion was put down very soon by Shizong's successor, Yelu Jing, the Emperor Muzong of Liao.