In 192, remnants of the Yellow Turban rebels from Qing Province invaded Yan Province and occupied Dongping and Rencheng. Liu Dai, Inspector of Yan Province, wanted to attack the rebels but Bao Xin, Chancellor of Jibei, advised him against it. Liu Dai ignored Bao Xin's warning, engaged the rebels in battle, and was eventually defeated and killed. At that time, Cao Cao's advisor Chen Gong urged him to take control of Yan Province and secure it as a base for conquering other territories. Chen Gong volunteered to persuade Liu Dai's followers to join Cao Cao. Bao Xin, who was friendly towards Cao Cao, travelled to Dong Commandery to invite Cao to be the new Inspector of Yan Province. Cao Cao then attacked the Yellow Turban rebels at Shouzhang but failed to defeat them. After that, Cao Cao reformed his army, enforced military rules more strictly, and used incentives to encourage his men. He recognized that the rebels did not have a stable flow of supplies, as they relied on plundering to sustain themselves. Hence, Cao Cao launched surprise attacks on the rebels, prevented them from pillaging, and achieving ultimate victory and forcing the rebels to retreat north. Cao Cao pursued the rebels and defeated them again at Jibei. The rebels, numbering more than 300,000, including 100,000 civilians, surrendered to Cao Cao. Cao reorganized the surrendered troops to form the Qingzhou Corps, while implementing the tuntian system for the people to provide for themselves and the military. In 193, Cao Cao's father Cao Song was killed by Zhang Kai, a subordinate of Tao Qian, Governor of Xu Province. In retaliation, Cao Cao launched an attack on Tao Qian, sweeping through Tao's lands and slaughtering thousands of Xu Province's population, including civilians. Tao Qian retreated to Tancheng, where Cao Cao was unable to conquer the city and retreated after his army was running low on supplies. The following year, Cao Cao attacked Tao Qian again, conquering many counties in Langya and Donghai commanderies of Xu Province. Just then, Cao Cao's subordinates Zhang Miao and Chen Gong rebelled against him and aided Lü Bu in taking over his home base of Yan Province. Cao Cao then decided to abandon his campaign on Tao Qian and turn back to retake Yan Province.
The battle
Cao Cao and Lü Bu's forces were locked in a stalemate for at least a hundred days, with Cao on the disadvantageous end. Eventually, Lü Bu abandoned his position because of an outbreak of famine. Cao Cao then laid siege to Lü Bu at Juye, Puyang. Cao Cao's advisors Xun Yu and Cheng Yu defended the cities of Juancheng, Fan and Dong'e, but this left only two counties with solid defenses, so Cao Cao led his army back. Lü Bu arrived and was unable to take Juancheng by siege so he went west and garrisoned Puyang. Lü Bu re-stationed his forces to the east at Shanyang. Lü Bu sortied out with his cavalry and charged Cao Cao's Qingzhou Corps. The Qingzhou Corps fled in terror and Cao's formations fell into disarray. Seeing the confusion, Cao Cao quickly galloped ahead, but when a fire broke out he fell from his horse and burnt the palm of his left hand. Cao's army halted before they reached camp because most of the generals had not seen their lord and feared for his safety. Cao Cao then strained himself to rouse his men, ordering that siege weaponsbe prepared immediately so that they can besiege Lü Bu again. Zhang Miao followed Lü Bu and left his brother Zhang Chao, Administrator of Guangling, to take care of their family at Yongqiu. Cao Cao laid siege to Yongqiu for several months and eventually captured the city, killing Zhang Chao and his family. Zhang Miao pleaded for assistance from Yuan Shu but was rejected and killed by his soldiers. At the same time, a locust plague broke out, causing many to starve while some resorted to cannibalism. Lü Bu had also used up all his provisions, horse feed, and grain supplies so both sides were forced to withdraw. When Cao Cao later surrounded Lü Bu at Puyang, the influential Tian clan, who were initially on Lü's side, switched allegiance to Cao and allowed his forces to enter the city. Cao Cao set fire to the eastern gate as a sign that he had no intention of reversing course, thereupon he came under attack and was defeated. Some of Lü Bu's horsemen captured Cao Cao but were unaware of his identity. Cao Cao saw a man riding on a yellow horse and lied that the man was him, so Lü Bu's horsemen released him and chased the rider. Cao Cao then dashed through the burning eastern gate and escaped from Puyang. Within two years, Cao Cao was able to recapture all the cities in Yan Province and defeated Lü Bu at Juye. Lü Bu then fled eastwards to join Liu Bei, who had taken over Xu Province from Tao Qian.
Aftermath
In 196, Lü Bu turned against Liu Bei, who had offered him refuge in Xu and led to the subsequent Battle of Xiapi in 198, when the allied forces of Cao Cao and Liu Bei launched an attack on Lü Bu in Xu Province. Lü Bu was executed on Cao Cao's order after his defeat.
The battle was featured as a stage in Koei's video gameDynasty Warriors 5: Xtreme Legends called the "Battle of Yan Province". In Dynasty Warriors 7, the battle is part of the "Battle of Xu Province", which has Lü Bu attacking Cao Cao's main camp. It should not be confused with the "Battle of Yan Province", which deals with remnants of the Yellow Turban rebels.