Battle of Ye
The Battle of Ye or Battle of Yecheng took place in 204 in the late Eastern Han dynasty. It was fought between the warlord Cao Cao and Yuan Shang, son and successor of Cao Cao's rival Yuan Shao, in the Yuan clan's headquarters Ye (in present-day Handan, Hebei). Cao Cao had been allied with Yuan Shang's elder brother Yuan Tan, who rebelled in a succession feud, and it was by Yuan Tan's request that Cao Cao laid siege to Ye. The successful siege of the city dislodged Yuan Shang's power from Ji Province, and Cao Cao would later use the city of Ye as a major base of his military power. Background
Yuan Shao, the powerful warlord of the north, had been decisively defeated by his southern neighbour Cao Cao in the Battle of Guandu in 200 and died two years later in frustration. Despite the defeat, the Yuan power bloc was by no means eliminated, for Yuan Shao was survived by his three sons Yuan Tan, Yuan Xi, and Yuan Shang; together with their cousin Gao Gan, the Yuan family still held on to the provinces of Ji, Qing, Bing, and You. The Yuan brothers were not on good terms, however—Yuan Tan, the oldest, contested the succession of his younger brother Yuan Shang, who was preemptively made heir by his supporters Shen Pei and Pang Ji, while the second son Yuan Xi was content with controlling the northernmost You Province and stayed out of his brothers' conflict. In the winter of 202, Cao Cao attacked Yuan Tan's position in Liyang, and Yuan Shang brought his troops to help his older brother. The two brothers held out for six months, before eventually driven back to Ye, where they successfully struck back and caused Cao Cao to withdraw for the time being. As soon as Cao Cao started to retreat in mid-203, the brothers' feud took a turn to the worse. Yuan Tan requested more troops and equipment so he could lead an army to pursue Cao Cao's men, but Yuan Shang refused, not wanting his brother to gain control of a bigger army. This act of distrust proved to be the last straw for Yuan Tan, as he rebelled from his younger brother and attacked the city of Ye in anger. Yuan Shang successfully defended Ye again and chased Yuan Tan 300 kilometers away to Nanpi, the seat of Bohai Commandery. Bohai was on the edge of the border with Qing Province, where Yuan Tan still held the title Inspector of that province; but while he could expect some aid from the base of his power, some of his own men rebelled against him, and the position was very insecure. So when Yuan Shang came to attack Nanpi, Yuan Tan fled south to Pingyuan, where he was again besieged. Here he was close to Cao Cao's Yan province, and his advisor Guo Tu suggested seeking help from Cao Cao. Guo Tu reasoned that Cao Cao's army would attack Ye, and while Yuan Shang was to return to save his capital, Yuan Tan could expect to take the lands to the north of Ye; and if Cao Cao was to be successful, Yuan Shang's power would be removed and the outstretched Cao Cao would retreat soon after, leaving Yuan Tan to gain control of the north and capable enough to make a stand against Cao Cao. Yuan Tan would not agree at first, but later sent Xin Pi as an ambassador to seek an alliance with Cao Cao. Since his withdrawal from Ye, Cao Cao's policy on the Yuan brothers was to let them wear each other out while he dealt with their ally Liu Biao in Jing Province (covering present-day Hubei and Hunan), and thus he was unsure what to make of the envoy. Cao Cao's advisor Xun Yu, who long advocated settling the north before turning elsewhere, reasoned that Liu Biao was not ambitious enough to be a threat, and it was high time to reap the benefits of the Yuan family feud before the brothers reunite. Cao Cao agreed, but he continued to put Jing Province first. Observing that Cao Cao was doubtful of Yuan Tan's sincerity in an alliance, Xin Pi spoke his mind:

Cao Cao accepted this advice, and Xin Pi thus switched sides. By the end of the year 203, Cao Cao again led his army across the Yellow River to Liyang and cemented the alliance by marrying his son Cao Zheng (曹整) with Yuan Tan's daughter. Yuan Shang indeed lifted the siege on Pingyuan and returned to guard Ye. With Yuan Tan's position safe, Cao Cao returned for the time being. The battle

Laying siege to Ye
In the spring of 204 Cao Cao crossed the Yellow River again and, mindful of the logistical problems for him to operate north of the Yellow River, started several waterworks projects to ease the transportation of supplies. While these works were under way, Yuan Shang apparently thought it safe to renew his attack on Yuan Tan in Pingyuan again, and left his loyal supporter Shen Pei to defend Ye. Some within Yuan Shang's camp found his priorities questionable, so when Cao Cao indeed advanced on Ye some time around the second or third month, the city's defenders under Su You (蘇由) intended to rebel and capitulate Ye to Cao Cao. The scheme was discovered, its plotters suppressed by Shen Pei within the city, and Su You fled to Cao Cao. Now Cao Cao's army was at the gates of Ye. He had mounds erected and tunnels dug to lay siege to the city. Having done this, Cao Cao left the general Cao Hong to maintain the siege while he turned west in the fourth month to attack Yin Kai (尹楷), a county magistrate under Yuan Shang who guarded the supply route from Bing Province. After storming Yin Kai's fortress Maocheng (毛城) at the foot of the Taihang Mountains, Cao Cao's army bypassed the defenses at Ye and defeated Ju Hu (沮鵠) in Handan, north of Ye. This development brought about more defections from Yuan Shang's county magistrates, and the local Heishan bandit lord Zhang Yan offered his assistance to Cao Cao. By this time Ye was cut off from the south, west, and north, while Yuan Shang was at its east facing Yuan Tan. Cao Cao's army returned to the siege-lines of Ye in the fifth month. Shen Pei vigorously defended the city throughout the siege; he had dug trenches within the city of Ye to counter Cao Cao's tunnels, and dealt with dissension among his ranks. One of his officers, Feng Li (馮禮) opened a sally port to let the enemy in. Shen Pei found out and had boulders dropped into the opening, blocking the gates and killed the roughly 300 soldiers who entered. Only a few weeks after the siege mounds and tunnels were constructed, Cao Cao changed tactics and ordered them destroyed. In their place, a shallow moat 40 li long was dug surrounding the city. At first the moat was shallow enough to be crossed, so Shen Pei laughed when he saw it and paid it no heed. Then, in a single night, Cao Cao dug the trench further, 20 feet wide and 20 feet deep, drawing water from the nearby Zhang River to the west and encompassing the Yanpi Marsh (晏陂澤) to the south and the Huan River to the east and north. The city became isolated, and by the beginning of autumn it was said that more than half in the city died of starvation. The arrival and repulsion of Yuan Shang
Some time in the summer Yuan Shang decided to abort his campaign against Yuan Tan and turned back to help defend his headquarters. Yuan Shang sent his Registrar (主簿) Li Fu (李孚) ahead to notify the defenders that relief was coming. To avoid detection by the besiegers, Li Fu brought only three horsemen, broke his staff of authority, and traveled by night. When he reached Cao Cao's camps surrounding the city from the north, he styled himself as a disciplinary officer and went through the camps finding fault with the sentries and punishing them. In this fashion he passed through the eastern camps from the northern camps into the camps on the southern side, where Cao Cao's personal camp was. Turning west from here, he arrested the officers on picket duty, tied them up, then made a dash to the city walls. He called to the defenders above, and they drew him in by rope. The ecstatic defenders sounded the drums in celebration of Li Fu's arrival, and Cao Cao laughed when he was made known of Li Fu's exploits. Li Fu was to return to relay Ye's situation to Yuan Shang. He realized that he could not use the same trick to get past the siege-lines and so conjured another ploy. He had Shen Pei arrange to have the old and weak sent out in the night to save food. During the night, several thousand people selected were sent away through three different gates, carrying white flags to surrender. Li Fu and his followers blended into the crowd and exited Ye by the northern gate, then escaped the surrounding camps from the northwest. Yuan Shang was glad to see Li Fu back, while Cao Cao clapped his hands and laughed again when he knew Li Fu escaped. Through the ruckus surrounding Li Fu's infiltration, Cao Cao's men knew that Yuan Shang was leading troops to relief Ye. Some of Cao Cao's officers were concerned that since Yuan Shang was coming home with Yuan Tan at his heels, Yuan Shang's soldiers would theoretically be on "death ground" (死地), where they would fight more fiercely to save themselves according to Sun Tzu's The Art of War. Cao Cao pointed out that he should indeed avoid battle with the reinforcements if Yuan Shang came on the main road from the east; but if Yuan Shang moved across to the northwestern hills, he would have friendly territory (Gao Gan's Bing province) behind him and his army would be easier to deal with. Yuan Shang approached obliquely from the north, to the delight of Cao Cao. When his scouts told him Yuan Shang's army reached Handan, Cao Cao candidly announced to his generals "I already have Ji Province, did you know? You shall see soon." From the western hills, Yuan Shang turned east to Yangping village (陽平亭), 17 li from Ye. On the bank of the Fu River (滏水) flowing north of the city, the relief army set camp and lit torches to signal the defenders for a coordinated attack, who lit another fire in acknowledgement. Shen Pei made a sortie to the north to rendezvous with Yuan Shang, but Cao Cao defeated both armies, driving Shen Pei back within the walls and Yuan Shang to Quzhang (曲漳), a bend on the Zhang River. Cao Cao then moved to surround Yuan Shang's position, but before the encirclement was completed, an afraid Yuan Shang sent Yin Kui (陰夔) and Chen Lin to negotiate for surrender. Cao Cao refused, and pressed Quzhang harder. One night, Yuan Shang abandoned Quzhang for Lankou (濫口) in the western Qi Hills (祁山), where Cao Cao followed and defeated Yuan Shang once more. Yuan Shang's army was completely scattered, his generals Ma Yan (馬延) and Zhang Yi (張顗) surrendered, and Yuan Shang himself fled far north to Zhongshan Commandery (中山). Cao Cao's men captured his baggages, seals, and other insignia. End of the siege
Cao Cao had the trophies of his victory against Yuan Shang shown to the defenders of Ye, which greatly lowered their morale, but Shen Pei was adamant. He rallied the troops based on the hope that Yuan Shang's second brother Yuan Xi would soon come to the rescue from You Province, thus they have no reason to worry about Yuan Shang's rout. When Cao Cao rode out to inspect the siege-works, Shen Pei had crossbowmen fire at him; the shots missed narrowly. A few nights later, on September 13 of the Julian calendar, Shen Pei's nephew Shen Rong (審榮) betrayed the city and opened the east gate at night to let in the enemy. As Cao Cao's men breached the city, Shen Pei executed the families of Xin Pi's brother Xin Ping, whom he considered traitorous and responsible for the downfall of the Yuan clan, then personally joined the defense at the gates. Shen Pei and the remaining defenders were pushed into the city proper, where fighting continued in the streets for a while. Two sources, the Parallel Annals of the Duke of Shanyang (山陽公載記) and the Chronicle of Emperor Xian (獻帝春秋), claim that Shen Pei hid in a well when all seemed lost, but the compiler Pei Songzhi rejects this account. Whatever the circumstance, Shen Pei was captured alive, and the siege finally ended after dragging on for more than half a year. Aftermath
Shen Pei remained defiant until the very end. He rebuked those who surrendered to Cao Cao and cursed the fact that the crossbow bolts did not hit Cao Cao. Cao Cao became impressed by his fierce loyalty and wanted to spare him, but Xin Pi and the others begged for his execution, so Shen Pei was to be beheaded. On the execution grounds, Shen Pei demanded to be allowed to face north as he died, since his lord Yuan Shang was in that direction. Cao Cao paid his respects at the tomb of Yuan Shao, where he wept for his friend-turned-enemy. He also offered condolences and pensions for members of Yuan Shao's family at Ye, though Cao Cao's son Cao Pi took Yuan Xi's wife Lady Zhen as his own wife in a serious breach of propriety. Politically, Cao Cao employed many of Yuan Shao's former officials, relieved all newly conquered territories of taxes for one year, and devoted his policies to rebuild the country devastated by the three-way war among Cao Cao and the Yuan brothers. All these gained him wide popularity, which, along with the contingents of Bing Province troops sent to settle at Ye, prevented the outbreak of rebellion in favour of the former rulers. Gao Gan, the Inspector of Bing Province, offered his nominal surrender to Cao Cao for the time being. For Cao Cao's successes, an imperial decree named him the Governor of Ji Province, but Cao Cao excused himself from the honour and continued with his old post as Governor of Yan Province. For the most part, the fall of Ye removed the Yuan clan's power from Ji province. Yuan Tan, who had been taking advantage of the siege of Ye to take territories that belonged to Yuan Shang, defeated Yuan Shang in Zhongshan and drove him further north to seek refuge under Yuan Xi in You Province. Since Yuan Tan was at least expected to help during the siege, Cao Cao now accused Yuan Tan of acting in bad faith, and cancelled the marriage between their families. Months later, Yuan Tan returned to Nanpi and Cao Cao moved to attack him, killing him in battle in the first month of 205. Yuan Shang and Yuan Xi were unable to reorganize their men in You Province after their setbacks and rebellions under their rule, and were decisively defeated along with their allies the Wuhuan in the Battle of White Wolf Mountain in 207. Ye proved to be a useful acquisition for Cao Cao, who took the city as his chief residence soon after its capture. Over the years the city and its surrounding Wei Commandery became the heart of Cao Cao's power, as he initiated several works in and around the city, including the much-celebrated Bronze Bird Terrace and the Xuanwu Pond (玄武池), where he trained his navy. In 213 Cao Cao was enfeoffed as the Duke of Wei, named after Ye's commandery, and the name stuck throughout the rise of the Cao family's fortunes, culminating in the state of Cao Wei that succeeded the Han dynasty in 220. According to Shui Jing Zhu, Ye was regarded as the Northern Capital during the Wei dynasty. Notes

References
Chen Shou and Pei Songzhi, Annotated Records of the Three Kingdoms

204
Ye 204
Military history of Hebei