The peasant uprising was a rebellion of Ba Sing Se's peasant population, instigated by the notion that the Earth King's rule was outdated and that he did not represent their interests. AvatarKyoshi ended the conflict, changed the Earth Kingdom into a constitutional monarchy and created the Dai Li as a safeguarding measure for the future.
Due to the 46th Earth King's lack of popularity, a highly capable warlord from the northwestern Earth Kingdom, Chin, was able to launch a military campaign, plunging the entire Earth Kingdom into civil war; only Kyoshi's peninsula and Ba Sing Se remained under the Earth King's dominion. When Chin threatened Kyoshi's peninsula, Kyoshi used the Avatar State to split her land away from the peninsula, creating Kyoshi Island. In the process, Chin fell to his death when the edge of the newly created cliff crumbled under his feet.
Although the land was now free from the threat of Chin the Conqueror, the 46th Earth King was seemingly incapable of leading his people or handling the war properly, and the citizens of Ba Sing Se, namely the peasants, were furious at his actions. Furthermore, Chin had gained popularity, and those who had supported his actions were resentful of the Earth King and were determined to remove him from power.
The peasants decided that the king's rule was outdated and that he did not represent their interests, feeling that it was time for a "new government". They formed an angry mob and swarmed the Upper Ring of Ba Sing Se, destroying priceless historical artifacts and buildings that represented the "old government". Unable to handle the revolt, the Earth King summoned Avatar Kyoshi to the capital to aid him and bring the revolt to an end. He commanded her to squash the unruly peasants and subdue the revolt in any way she could, but she promptly refused.
Furious about the fact that Kyoshi, an Earth Kingdom citizen, dared to defy her king, he ordered her arrest; however, the royal guards were no match for the Avatar, as Kyoshi easily brushed them aside with airbending. Enraged by the king's actions, Kyoshi asked him in return how he dared to defy his Avatar and proposed a compromise: the king needed to listen to the peasants grievances, as it was important that everyone in the Earth Kingdom had a voice in order for balance to prevail over tyranny. In return, she promised to protect the king's interests and Ba Sing Se's cultural heritage. Powerless against the might of the Avatar, the king complied and gave in to Kyoshi's request.
In order to keep her end of the bargain, Kyoshi immediately set to work training an elite force of earthbenders in the art of stealth, silence, and precision, a group that would soon be feared by all: the Dai Li. The uprising ended soon after, and order was finally restored to Ba Sing Se.
When she first created the organization, Kyoshi had no idea that the Dai Li would eventually become some of the most corrupt earthbenders in the world, abusing their powers in order to suppress instead of protect the citizens of Ba Sing Se. By the reign of the 52nd Earth King, the Dai Li had become corrupt to the point of launching a conspiracy to silence any citizen from speaking about the Hundred Year War, especially to the king.
The Dai Li eventually betrayed their nation in a successful coup orchestrated by the Fire NationPrincess, Azula, in which they arrested the entire Council of Five and allowed Fire Nation soldiers access into the city by destroying the two great walls that had protected Ba Sing Se for over one hundred years.