In
184, the
Yellow Turban Rebellion broke out. Liu Bei and his followers joined the volunteer army and scored several victories against the rebels. In
192, after suffering a defeat, Liu Bei traveled north to seek a position under Gongsun Zan, who placed him on the border with rival warlord,
Yuan Shao. For his subsequent military successes Liu Bei was made governor of
Pingyuan County (平原).
In
194, when
Cao Cao launched a campaign against
Tao Qian (陶謙), governor of
Xuzhou (徐州, present day northern
Jiangsu), Liú Bèi went to the rescue of the latter. Before any major confrontation was made, however, Cao Cao was forced to retreat to his own base in
Yanzhou (兗州, present day western
Shandong) as
Lü Bu had occupied much of the region with the help of several defectors. Liu Bei, however, did not return to Gongsun Zan but stayed on in Xuzhou, where Tao Qian placed him in command of 4,000 troops. When Tao Qian died of sickness shortly afterwards, he passed on the governorship of Xuzhou to Liu Bei, rather than his own sons.
On the other hand, Lü Bu was eventually defeated and, thinking that by forcing Cao Cao's retreat he had done Xuzhou a favor, he headed for the city of
Xiapi to seek refuge under Liu Bei. However, while Liu Bei was away defending his territory against
Yuan Shu, Lü Bu took over Xiapi, captured Liu Bei's family and declared himself the governor of Xuzhou. When Liu Bei returned, he garrisoned his troops in
Xiaopei (小沛, present day
Pei County, Jiangsu) and made peace with Lü Bu, whereupon his family was returned. However, Lü Bu grew wary of Liu Bei as the force of the latter expanded. Finally, in
198, he attacked Liu Bei in Xiaopei. The defeated Liu Bei sought help from Cao Cao, who personally led an army into Xuzhou and defeated Lü Bu for good. Liu Bei then followed Cao Cao back to the new capital
Xuchang.
At this time,
Emperor Xian, who had been held under the power of Cao Cao, secretly wrote a decree on a belt ordering the elimination of Cao Cao. The emperor then passed the belt to his uncle,
Dong Cheng. Dong Cheng then started plotting the assassination with Liu Bei and a few other colleagues. Before the act could be carried out, however, Liu Bei was sent out with
Zhu Ling (朱靈) to intercept Yuan Shu, who was traveling north to reconcile with his cousin, Yuan Shao. Liu Bei took the opportunity to kill
Che Zhou (車冑), governor of Xuzhou, and retake the region. In
200, Dong Cheng's plot leaked and the conspirators were promptly executed.
In the same year, after an initial attack led by
Liu Dai (劉岱) and
Wang Zhong (王忠) failed, Cao Cao personally led an attack against Liu Bei and defeated the latter. He also captured Liu Bei's greatest general and right arm, Guan Yu. Liu Bei fled north to Yuan Shao, who was at that time amassing troops on the northern shore of the
Yellow River and preparing for a major confrontation with Cao Cao. Seeing initial setbacks Yuan Shao suffered, Liu Bei was unwilling to stay. He persuaded Yuan Shao to allow him to lead a force to travel south to make an alliance with
Liu Biao, governor of
Jingzhou (荆州, present day
Hubei and
Hunan). However, Yuan Shao was soon routed at the decisive
Battle of Guandu. Liu Bei then switched allegiance and sought a position under Liu Biao.