In 22, Wang Mang finally saw (as many of his officials had tried to tell him earlier) that the agrarian rebellions were posing a much greater threat to his rule than the Xiongnu. He commissioned two of his key officials, Wang Kuang (王匡, not to be confused with the Lülin leader of the same name) and Lian Dan to attack agrarian rebellions, with the Chimei being their first target. Wang and Lian had some initial successes, but Wang insisted on having them keep fighting without resting, and the fatigued forces eventually collapsed.
In the same year, Lülin forces suffered a major plague, killing about half of the rebels. This caused them to divide. One branch headed west to the region of modern
Hubei, while the other headed north to the region of the modern
Liu's revolt merge with Lülin agrarian revolt
Around this time, the most ambitious of the rebels would emerge.
Liu Yan, a descendant of a distant branch of the Han imperial clan, who lived in his ancestral territory of Chongling (舂陵, in modern
Hubei), had long been disgusted by Wang Mang's usurpation of the Han throne, and had long aspired to start a rebellion. His brother
Liu Xiu, by contrast, was a careful and deliberate man, who was content to be a farmer. Around this time, there were prophecies being spread about that the Lius would return to power, and many men gathered about Liu Yan, requesting that he lead them. He agreed, and further joined forces with the branch of Lülin forces who had entered the proximity, and they began to capture territory instead of simply roving and raiding. (It was said that many of the neighborhood young men were initially hesitant to join the rebels, but when they saw that Liu Xiu, whom they considered wise and careful, was joining as well, they agreed to.) In 23, under Liu Yan's leadership, the joint forces had a major victory over Zhen Fu (甄阜), the governor of the Commandery of Nanyang, killing him. They then besieged the important city of Wancheng (the capital of Nanyang).
A new imperial pretender
By this point, many other rebel leaders had become jealous of Liu Yan's capabilities, and while a good number of their men admired Liu Yan and wanted him to become the emperor of a newly declared Han Dynasty, they had other ideas. They found another local rebel leader, also of Han imperial descent,
Liu Xuan, who was considered a weak personality, and requested that he be made emperor. Liu Yan initially opposed this move and instead suggested that Liu Xuan carry the title "Prince of Han" first (echoing the founder of the Han Dynasty,
Emperor Gao). The other rebel leaders refused, and in early 23, Liu Xuan was proclaimed Emperor Gengshi of Han. Liu Yan became prime minister.
The Battle of Kunyang
In the spring of 23, a major military confrontation sealed Wang Mang's fate. He sent his cousin Wang Yi (王邑) and his prime minister Wang Xun (王尋) with what he considered to be overwhelming force, some 430,000 men, intending to crush the newly reconstituted Han regime. The Han forces were at this point in two groups—one led by Wang Feng, Wang Chang (王常), and Liu Xiu, which, in response to the arrival of the Xin forces, withdrew to the small town of
Kunyang (昆陽, in modern
Henan) and one led by Liu Yan, which was still besieging Wancheng. The rebels in Kunyang initially wanted to scatter, but Liu Xiu opposed it; rather, he advocated that they guard Kunyang securely, while he would gather all other available troops in surrounding areas and attack the Xin forces from the outside. After initially rejecting Liu Xiu's idea, the Kunyang rebels eventually agreed.
Liu Xiu carried out his action, and when
he returned to Kunyang, he began harassing the besieging Xin forces from the outside. Wang Yi and Wang Xun, annoyed, led 10,000 men to attack Liu Xiu and ordered the rest of their troops not to move from their siege locations. Once they engaged in battle, however, after minor losses, the other units were hesitant to assist them, and Liu Xiu killed Wang Xun in battle. After that, the Han forces inside Kunyang burst out of the city and attacked the other Xin units, and the much larger Xin forces suffered a total collapse. The soldiers largely deserted and went home, unable to be gathered again. Wang Yi had to withdraw with only several thousand men back to Luoyang. This was a major blow to Xin, psychologically; from this point on, there would be no hope for it.
Conquest of the capitals
Emperor Gengshi then commissioned two armies, one led by Wang Kuang, targeting Luoyang, and the other led by Shentu Jian (申屠建) and Li Song (李松), targeting Chang'an directly. All the populace on the way gathered, welcomed, and joined the Han forces. Shentu and Li quickly reached the outskirts of Chang'an. The rebels sacked the capital on 4 October, 23.
 In response, the young men within Chang'an also rose up and stormed
Weiyang Palace, the main imperial palace. Wang died in the battle at the palace (by Du Wu (杜吳)), as did his daughter Princess Huanghuang (the former empress of Han). After Wang died, the crowd fought over the right to have the credit for having killed Wang, and tens of soldiers died in the ensuing fight. Wang's body was cut into pieces, and his head was delivered to the provisional Han capital Wancheng, to be hung on the city wall. However, the angry people took it off the wall and kicked it around, and someone cut his tongue off. Eventually, the head was preserved and kept in a court vault, until it was destroyed in a fire in the