In 204 BC, the Yan kingdom surrendered to Han Xin, and Zhang Er was appointed as the King of Zhao. Xiang Yu constantly sent his armies to attack Zhao but Han Xin and Zhang Er managed to hold their ground. Xiang Yu then turned his attention towards Xingyang, where Liu Bang was stationed. Liu Bang was forced to retreat to Chenggao, where he was besieged by Xiang Yu. Eventually, he had no choice but to head north of the Yellow River to join Han Xin. In a surprise move, Liu Bang took over Han Xin and Zhang Er's command of the Han army in Zhao. He then ordered Han Xin to lead an army to attack the Qi kingdom.