Li Yuanhao, nicknamed Weili, was from the Tuoba tribe of Dangxiang. He was the eldest son of Li Deming and his mother was Wei Mu. He liked to read military books since he was a child, was proficient in Tibetan and Chinese characters, and studied Buddhism intensively. He once advised his father not to submit to the Song Dynasty, saying, "When a hero is born, he will be the king's domineering king, so how can Jinqi do it." In 1028, he led his army to attack the Uighurs in Ganzhou and was made Crown Prince. After that, he captured Liangzhou. When Deming died in 1032, he succeeded him as the leader of the Xiazhou regime.
After he succeeded to the throne, he abandoned the two surnames of Li and Zhao given by the Tang and Song Dynasties, changed his surname to Wei, ordered the people to be bald, promoted Xingzhou to Xingqing Prefecture, established an official system and a military system, ordered Ye Lirenrong to create the Western Xia script, and captured the three prefectures of Gua, Sha, and Su, all in Hexi. In 1038, he officially proclaimed himself emperor, and the country was named Daxia. He immediately went to war with the Song Dynasty, winning three battles at Sanchuankou, Haoshuichuan, and Dingchuanzhai. In 1044, he signed a Qingli peace treaty with the Song Dynasty. In the same year, he defeated Liao Xingzong in Hequ.
Years of war made Western Xia financially strapped. In his later years, Yuan Hao was jealous and prone to killing, and indulged in drinking and sex. He successively killed the Yeli brothers, deposed Yelihuanghou, and took away the fiancée of Crown Prince Ning Lingge from the Yi family. In the first month of 1048, Ning Lingge entered the palace to assassinate Yuan Hao and cut off Yuan Hao's nose. Yuan Hao died of his injuries at the age of forty-six and was buried in Tailing.
Li Yuanhao is the most outstanding leader of the Dangxiang nation. He created writing, established the official and military system, and established national identity. With the power of a small country, he defeated the Song army three times and defeated the Liao army. He created a pattern in which Song, Liao, and Xia stood side by side. Western Xia has continued for nearly two hundred years. However, he resorted to militarism and used troops for years to deplete the country and the people. In his later years, he was jealous of murderers, indulged in licentiousness, and took away his son's wife. Eventually, father and son killed each other, which also left Western Xia with the long-term hidden danger of the exclusive power of his relatives.