Emperor Wu of (Liu) Song ((; 16 April 363According to Liu Yu's biography in Book of Song, he was born in the night of the renyin day of the 3rd month of the 1st year of the Xingning era of Sima Pi's reign. This corresponds to 16 Apr 363 in the Julian calendar. () Song Shu, vol. 01– 26 June 422According to Liu Yu's biography in Book of Song, he died aged 60 (by East Asian reckoning) on the guihai day of the 5th month of the 3rd year of the Yongchu era of his reign. This corresponds to 26 Jun 422 in the Julian calendar. Song Shu, vol. 03), personal name Liu Yu (), courtesy name Dexing (), childhood name Jinu (),() Song Shu, vol. 27 was the founding emperor of the Liu Song dynasty of China. He came from a humble background, but became prominent after leading a rebellion in 404 to overthrow Huan Xuan, who had usurped the Eastern Jin throne in January that year. After that point, using a mixture of political and military skills, Liu Yu gradually concentrated power in his own hands while expanding Jin's territory. In 420, he forced Emperor Gong of Jin to yield the throne to him, thus ending the Eastern Jin dynasty and establishing the Liu Song dynasty. He ruled only briefly, for two years, before dying and passing the throne to his son, Emperor Shao of Song. An outstanding commander, perhaps the greatest of his era, he conquered two of the Sixteen Kingdoms and remained undefeated throughout his military career. The History of the Southern Dynasties described Liu Yu as seven chi and six cun tall() Nan Shi, vol. 01 (approximately .)

Early life Liu Yu was born in 363, to his father Liu Qiao () and mother Zhao Anzong (), while they were living at Jingkou (京口, in modern Zhenjiang, Jiangsu). His great-grandfather Liu Hun () was originally from Pengcheng (彭城, in modern Xuzhou, Jiangsu), before moving to Jingkou.Book of Song, chp. 1 (The Chronicle of Emperor Wu, Part 1). Liu Qiao was said to be a 20th generation descendant of Han dynasty's Prince of Chu, Liu Jiao (), a younger brother of Han's founder Emperor Gaozu of Han.Book of Song, vol. 1 Liu Qiao was a police officer, while Zhao Anzong was the daughter of a commandery governor. They had married in 360, and lived in fair poverty. Lady Zhao died immediately after giving birth to Liu Yu, and Liu Qiao, unable to take care of the child financially or otherwise, considered abandoning the child. Upon hearing this, Liu Yu's aunt, who had given birth to his cousin Liu Huaijing () less than a year ago, went to Liu Qiao's house and took Liu Yu, weaning Liu Huaijing and giving her milk to Liu Yu instead. At some point, Liu Qiao remarried, and his new wife Xiao Wenshou bore him two sons, Liu Daolian () and Liu Daogui (). Liu Yu was said to be respectful to his stepmother and treated her as his own mother.

It is not known when Liu Qiao died, but in any case, Liu Yu grew up with great ambitions and was said to be strong and brave, but he was poor and uneducated, knowing only a few characters. He maintained himself by selling straw sandals, and he liked gambling. The people in his village all looked down on him. At some point, he became an officer under the general Sun Wuzhong ().

When the magician Sun En rebelled against Jin rule in 399, Liu Yu joined the army of the general Liu Laozhi (), and he became friends with Liu Laozhi's son Liu Jingxuan (). On one occasion, he led some tens of soldiers on a scouting mission, when they suddenly encountered several thousand of Sun's soldiers. All of Liu Yu's soldiers were killed, and Liu Yu fell onto a riverbank, but he stood his position there and killed all of Sun's soldiers who dared to approach. Liu Jingxuan, meanwhile, realizing that Liu Yu had been away from camp for too long, went to try to find him, and saw him alone chasing and dispersing thousands of Sun's soldiers. He greatly praised Liu Yu.

Both because of his bravery and his friendship with Liu Jingxuan, Liu Yu rose through the ranks of Liu Laozhi's army. Liu Laozhi, at the time, was a powerful warlord who controlled modern Jiangsu and Zhejiang except for the region around the capital Jiankang. In 401, with Sun En, who had fled to Zhoushan Island in late 399, trying to launch a comeback and attacking Haiyan (海鹽, in modern Jiaxing, Zhejiang), Liu Yu fought him, winning several victories over him despite being outnumbered. However, eventually Sun En was able to regroup and head toward Jiankang, which he could not capture and was forced to withdraw from. He regrouped on a sea island. By imperial edict (probably at Liu Laozhi's wishes), Liu Yu was made the governor of Xiapei Commandery (, roughly modern eastern Xuzhou, Jiangsu), and he was ordered to attack Sun En on his island. This allowed Liu Yu to win victories over Sun En. Sun En began to grow weaker and headed south on the coast, with Liu Yu following. In winter 401, Liu Yu defeated Sun En again at Haiyan, forcing Sun to flee far from the coast.

In 402, as the regent Sima Yuanxian and the warlord Huan Xuan prepared for battle, Sima Yuanxian believed that he had Liu Laozhi's support, and Liu Laozhi postured in support of Sima Yuanxian by bringing his forces to Jiankang. However, when Liu Yu requested to engage Huan Xuan, Liu Laozhi refused to give permission. Huan Xuan then sent messengers to try to persuade Liu Laozhi to switch sides, despite the oppositions of his nephew He Wuji ()Per He Wuji's biography in Jin Shu, Liu Laozhi's sister was his mother. and Liu Jingxuan, as well as Liu Yu. Without support from Liu Laozhi, Sima Yuanxian's forces collapsed in response to Huan Xuan's attack, and Sima Yuanxian and his father Sima Daozi were killed by Huan Xuan.Sima Daozi was poisoned in early 403, months after Yuanxian's death in April 402. Huan Xuan, who did not trust Liu Laozhi, immediately stripped Liu Laozhi of his military command, and Liu Laozhi, upon receiving the order, considered resisting it. He requested Liu Yu's opinion, and Liu Yu found the idea foolish, left Liu Laozhi's army, and returned to Jingkou as a civilian; He Wuji joined him as well. With the rest of the army not willing to go with his plan either, Liu Laozhi committed suicide, and Liu Jingxuan fled to Later Qin and then to Southern Yan.

By summer 402, however, Liu Yu was again in the army, and by 403 he carried a general's rank, when Sun En's nephew Lu Xun, who had succeeded him after his death in battle in 401, attacked Dongyang (, in modern Jinhua, Zhejiang), and Liu Yu repelled Lu's attack. He then counterattacked and won several battles over Lu, forcing Lu to head south on the sea. At this time, He Wuji tried to persuade him to declare a rebellion at Shanyin (, in modern Shaoxing, Zhejiang) against Huan Xuan, but at the advice of Kong Jing (), he declined at this time, waiting for Huan Xuan to seize the throne so that he would have a reason. When Huan Xuan's cousin Huan Qian () asked Liu Yu's opinion about whether Huan Xuan should receive the throne, Liu Yu pretended to be a Huan clan loyalist and encouraged Huan Xuan to receive the throne. In winter 403, Huan Xuan forced Emperor An of Jin to yield the throne to him, establishing the new state of Chu. Liu Yu initially continued to feign loyalty, and Huan Xuan, believing in him and his talents, considered giving him greater authorities, despite counsel from his wife Empress Liu that Liu Yu could not be trusted and should be executed.

Campaign against Huan Xuan Meanwhile, Liu Yu and He Wuji, now at Jingkou, continued their planning to rebel against Huan Xuan now that Huan Xuan had seized the throne. They were soon joined in their plans by Liu Yi () and Meng Chang (), and soon a number of other disaffected individuals joined their plan, with Liu Yu as the leader. Their plan was to simultaneously start several uprisings:

Liu Yi, Liu Yu's brother Liu Daogui, and Meng would surprise and kill Huan Xuan's cousin Huan Hong (), then the governor of Qing Province (, then with its headquarters at Guangling (, in modern Yangzhou, Jiangsu)), and seize Guangling. Zhuge Zhangmin () would surprise and kill Diao Kui (), the governor of Yu Province (, then modern central Anhui) and seize Liyang (, in modern Chaohu, Anhui). Wang Yuande (), Xin Huxing (), and Dong Houzhi () would rise in Jiankang and attack Huan Xuan directly. Liu Yu, He Wuji, and the other conspirators would surprise and kill Huan Xuan's cousin Huan Xiu () the Prince of Ancheng, then the governor of Xu () and Yan () Provinces, then with their headquarters at Jingkou, and seize Jingkou.

The conspirators put their plans into action. Liu Yu and He Wuji were able to surprise Huan Xiu and seize Jingkou, and Liu Yu then persuaded the capable administrator and writer Liu Muzhi to join him as his propaganda specialist and assistant. Liu Yi, Liu Daogui, and Meng Chang persuaded Huan Hong to go on a hunt, and as Huan Hong opened the city gates to let his hunters out, they surprised him and killed him. However, Zhuge Zhangmin's plans were leaked, as were those of the conspirators at Jiankang. All were arrested, and the conspirators at Jiankang were executed. (Zhuge Zhangmin was subsequently rescued before he could be executed.)

Liu Yu quickly headed for Jiankang, and Huan Xuan, hesitant to engage him directly, waited at Jiankang, trying to see if he could wear Liu Yu down, although, at Huan Qian's insistence, he sent a detachment to try to stop Liu Yu. However, Liu Yu quickly defeated Huan Xuan's generals Wu Fuzhi () and Huangfu Fu () and arrived at Jiankang. He then defeated Huan Qian, and Huan Xuan, in panic, fled west, intending to go back to his power base at Jiangling (江陵, in modern Jingzhou, Hubei). Liu Yu entered Jiankang and declared the reestablishment of Jin, even though at this time Emperor An and his brother Sima Dewen were both still in Huan Xuan's control. Liu Yu entrusted most administrative matters to Liu Muzhi while dealing severe punishment to corrupt officials and those who had supported Huan Xuan, and quickly the government was cleaned up. (The only Huan Xuan supporter who was spared was Huan Xuan's prime minister Wang Mi (), who, when Liu Yu was poor, had helped him and paid off his gambling debts, and therefore Liu Yu not only spared but entrusted him with high posts.) Liu Yu, however, prepared for the contingency that Emperor An would not be recovered by making Sima Zun () the Prince of Wuling (a grandson of Emperor An's great-grandfather Emperor Yuan) acting emperor.

Liu Yu sent Liu Yi, He Wuji, and Liu Daogui west to attack Huan Xuan. They quickly defeated Huan Xuan's general He Danzhi () and took Jiang Province (, modern Jiangxi and Fujian), and then continued to head toward Jiangling. They encountered Huan Xuan's much larger force at Chenghong Island (), in modern Ezhou, Hubei), and despite the numerical disadvantage, they crushed Huan Xuan's forces. Huan Xuan fled back to Jiangling with Emperor An, while Huan Xuan's brother-in-law Yin Zhongwen () turned against him and took Emperor An's wife Empress Wang Shen'ai and Emperor Mu's wife Empress Dowager He to Jiankang.

Once Huan Xuan arrived back in Jiangling, he tried to prepare to flee to his distant relative, Huan Xi () the governor of Liang Province (, modern southern Shaanxi and northwestern Hubei). His forces collapsed, however, refusing to follow his orders. At the inducement of his subordinate Mao Xiuzhi (), whose uncle Mao Qu () was the governor of Yi Province (modern Sichuan and Chongqing), he decided to try to flee to Yi Province instead, but on the way, he was intercepted by Mao Qu's subordinates Mao Youzhi () and Fei Tian (), who attacked him, and the officer Feng Qian () beheaded him. The officials Wang Tengzhi () and Wang Kangchan () then declared Emperor An's restoration at Jiangling.