Zhang Xiu was from Zuli County, Wuwei Commandery, which is in present-day Jingyuan County, Gansu. He was a distant nephew of Zhang Ji, who served under the tyrannical warlord Dong Zhuo. After Dong Zhuo's death in 192, his former subjects, including Zhang Ji, waged a coup and took over the imperial capitalChang'an. For his part in the coup, Zhang Xiu was also promoted to General who Builds Loyalty and enfeoffed as the Marquis of Xuanwei. After Zhang Ji's death, Zhang Xiu took over command of his troops and occupied Wan. He allied himself with Liu Biao, the Governor of Jing Province and a major warlord of the time. In 197, the warlord Cao Cao, who controlled the Han central government, led his forces on campaigns against rival warlords. When he arrived at the banks of the Bai River, Zhang Xiu promptly surrendered to him and was allowed to retain control over Wan. Cao Cao then took Zhang Ji's widow as a concubine, which angered Zhang Xiu. Cao Cao heard of Zhang Xiu's displeasure and plotted to kill him. However, the plan was leaked and Zhang Xiu waged a surprise attack against Cao Cao, leading to the Battle of Wancheng. Cao Cao's personal bodyguard Dian Wei died defending the front gate to the camp so that Cao Cao could escape through the back gate. In the hasty retreat, Cao Cao's eldest son, Cao Ang, offered his own horse to his father, whose steed was felled by enemy arrows, and was killed by the pursuers. Cao Cao's nephew Cao Anmin was also killed. Henceafter, Cao Cao had sent forces to attack Zhang Xiu for years without success. In 200, however, Zhang Xiu heeded the suggestion from his adviser, Jia Xu, and surrendered to Cao Cao again. Cao Cao decided to put aside his past feud with Zhang Xiu and accept his surrender. He also proposed a marriage between his son Cao Jun and Zhang Xiu's daughter. Around the time, Cao Cao was at war with the northern warlord Yuan Shao at the Battle of Guandu. Having performed well during the conflict, Zhang Xiu was soon promoted to General who Defeats the Qiang. In 207, Zhang Xiu died at Liucheng en route to join Cao Cao in a northern campaign against the Wuhuan tribes. The Han imperial court honoured him with the posthumous title "Marquis Ding", literally meaning "steadfast marquis".