During the late Eastern Han Dynasty, as various warlords vied for supremacy and heroes emerged in great numbers, Yuan Shao was one of them. The Yuan family had served as officials for generations, with several members holding high-ranking positions in the imperial court, and Yuan Shao himself also occupied a high office, earning the family the prestigious title of "Four Generations of Three Dukes." From a young age, Yuan Shao was brave and fierce, endearing him to his elders. Relying on his exceptional talents, he became a court attendant at a very young age, then quickly rose through several official ranks, eventually becoming the county magistrate of Puyang when he was not yet twenty years old.
Not long after becoming county magistrate, Yuan Shao's mother died of illness, followed by his father's passing. Yuan Shao resigned from office to observe a six-year mourning period at home. The imperial court intended to summon him back to officialdom after the mourning period ended, but Yuan Shao refused. Instead, he found a quiet place in Luoyang and lived in seclusion.
At that time, the Eastern Han Dynasty was in an era of eunuch domination, with corruption and chaos pervading the court both inside and out. To protect their own interests, the eunuchs ruthlessly persecuted the partisans, leaving virtuous and loyal scholars in constant fear. Although Yuan Shao lived in seclusion in the mountains, he was fully aware of the outside situation. He secretly maintained close ties with the partisans, especially their leading figures like Chen Fan and Li Ying. The partisans were also willing to stay in contact with Yuan Shao, and when major issues arose, he would offer them advice and strategies. After the Disaster of the Partisan Prohibition broke out, Chen Fan and Li Ying secretly sought out Yuan Shao several times, asking him to help find safe havens for the partisans. It was during that time that Yuan Shao met Cao Cao, and the two formed an alliance to jointly oppose the eunuchs.
Yuan Shao tried his best to conceal his actions with great caution, but before long the eunuchs still got wind of them; they sent the chief eunuch Zhao Zhong to warn Yuan Shao not to interfere in court affairs, and Yuan Shao pretended not to know what was going on, so Zhao Zhong stormed back in a huff.
After the Yellow Turban Rebellion broke out, Emperor Ling of Han, under duress, released the imprisoned partisans from jail and called for a united effort to fight the rebel forces. Grand General He Jin had long heard of Yuan Shao's talent, and seizing this opportunity, he invited Yuan Shao back to the court—partly to stabilize the political situation and partly to join forces with him to eliminate the eunuchs. He Jin's idea coincided perfectly with Yuan Shao's, and the two quickly became close friends.
The Yellow Turban Army grew increasingly powerful across the land, while eunuch tyranny became even more rampant. Zhang Jun, a court official, could not tolerate the eunuchs' actions and submitted a memorial to Emperor Ling of Han listing many of their crimes, only to be thrown into prison and tortured to death. The eunuchs also controlled the military authority of the Eastern Han Dynasty, and even General-in-Chief He Jin had to obtain their permission to mobilize troops.
In 189 AD, Emperor Ling of the Han Dynasty was gravely ill, and the crown prince had not yet been chosen, with eunuchs and officials both seeking to seize power through the emperor's decision on the heir. Emperor Ling had two sons: Liu Bian, born to Empress He, and Liu Xie, born to Consort Wang. The emperor disliked Liu Bian, considering him shallow in learning and incapable of handling state affairs, and intended to pass the throne to Liu Xie. However, China had long valued descendants born to the primary wife, and if a son from a concubine were to inherit the throne, the officials would surely oppose it. Emperor Ling was distressed and uncertain, but a eunuch who guessed his thoughts suggested sending General-in-Chief He Jin to suppress a rebellion in the provinces, which would then allow Liu Xie to be smoothly established as crown prince. He Jin, however, was not fooled; realizing the eunuchs aimed to remove him from the capital, he sent Yuan Shao to lead the campaign in his stead, thwarting the eunuchs' plot. After Emperor Ling's death, the eunuch Jian Shuo attempted to eliminate He Jin and install Liu Xie as emperor, but He Jin was well-prepared and instead forced Jian Shuo to support Liu Bian's ascension to the throne, historically known as Emperor Shao of Han. Yuan Shao's uncle, Yuan Wei, and General-in-Chief He Jin served together as regents.
Jian Shuo was very unwilling to accept defeat and constantly looked for opportunities to eliminate He Jin, but He Jin found an excuse to throw him into prison. Yuan Shao said to He Jin, "Now that the court is under your control, General, and your trusted allies hold significant military power, why not take this chance to wipe out all the eunuchs? Keeping them around will only bring disaster in the long run." He Jin thought this over and agreed that the eunuchs should be removed, so he went to the palace to discuss the matter with Empress Dowager He. However, she opposed the idea because the eunuchs frequently bribed her mother and brother, and she feared they would implicate her family. Upon hearing this, Yuan Shao went to He Jin again and said indignantly, "The eunuchs have persecuted many loyal and upright officials. No one wants to see them continue unchecked. Now that they know our plan, if we don't act quickly, our lives may be in danger." But due to interference from Empress Dowager He's family and He Jin's own indecisiveness, the matter remained stalled.
Seeing this situation, Yuan Shao took matters into his own hands, urging He Jin to summon local troops to the capital and recruit soldiers everywhere, which terrified Empress Dowager He and the eunuchs. The Empress Dowager ordered the eunuchs to leave the palace to take refuge, and He Jin could have had them all killed, but he showed mercy, allowing them to escape. The eunuchs harbored resentment and tricked He Jin into the palace, killing him in front of the Empress Dowager. When news of He Jin's death spread, his subordinates led their troops to the palace to avenge him, and many eunuchs who failed to flee in time were killed on the spot.
Before the troops stormed in, several eunuchs seized Emperor Shao of Han, Liu Bian, and the Prince of Chenliu, Liu Xie, and fled the palace, where they happened to encounter Dong Zhuo, the Governor of Bingzhou. Dong Zhuo had originally been ordered by He Jin to lead his army into the capital, and now, seeing the young emperor before him, he feigned a warm welcome for Liu Bian and Liu Xie, escorting them and his troops to Luoyang. It was only later that people learned Dong Zhuo's true intention: he planned to hold the emperor hostage to command the feudal lords, aiming to bring the entire realm under his control.
At this time, Yuan Shao and his uncle Yuan Wei were in the capital, carrying out a massive purge of eunuch factions, not even sparing their clansmen; some men without beards were mistaken for eunuchs and killed as well.
After Emperor Shao of Han fell into Dong Zhuo's hands, all court affairs required Dong Zhuo's approval; Yuan Shao and Dong Zhuo frequently clashed over differing opinions when handling government matters. To avoid being killed by Dong Zhuo, Yuan Shao took advantage of an unguarded moment to flee and hide in Jizhou, cutting off all contact with the court.