During the period known as Sixteen Kingdoms in Chinese history when the northern China was repeatedly invaded and occupied various nomadic peoples from further north, Zhangjiakou area became part of Dai, Former Yan, ultimately ruled by Northern Wei of Xianbei. In 310, by helping Jin's Liu Kun, the governor of Bingzhou to fight Xiongnu state of Han Zhao, Tuoba Yilu, the supreme chieftain of the Tuoba, was appointed Duke of Dai by Western Jin and since 315, the King of Dai. In 376, Dai was conquered by Former Qin state.