In 211, Cao Cao defeated a warlord coalition in the Wei valley, ending in the Battle of Huayin, capturing the territory around Chang'an. In 211, Liu Bei accepted an invitation from Liu Zhang to come to Yi Province for aiding the latter against a threat from the north, namely Zhang Lu of Hanzhong. Liu Bei met people within Liu Zhang's court who wished that he would replace Liu Zhang as the ruler of Yi Province. A year after his arrival, Liu Bei came into conflict with Liu Zhang and turned against him. In summer of 214, Liu Bei received the surrender of Liu Zhang, capturing Yi Province, and established his regime at Chengdu. In 215, Cao Cao captured Hanzhong after attacking and receiving the surrender of Zhang Lu. He had launched the attack from Chang'an through the Qinling Mountain passes to Hanzhong. The conquest threatened Liu Bei's territory located directly to the south. Cao Cao progressively increased his titles and power under the puppet Emperor Xian. He became the Chancellor in 208, the Duke of Wei in 214, and the King of Wei in 217. He also compelled Sun Quan to accept suzerainty to Wei, but it had no real effect in practice.