Between 212 and 214, the warlord Liu Bei engaged Liu Zhang in a war for control of Yi Province. When Liu Bei's forces attacked Zitong County, Wang Lian ordered his troops to hide behind the city walls and close the gates, and refused to surrender to Liu Bei. Liu Bei admired Wang Lian for his loyalty towards Liu Zhang, so he called off the attack on Zitong County.