In the final years of Wang Mang's Xin Dynasty, the entire realm was engulfed in warfare and chaos. At that time, General Wei Wang Lin, a cousin of Wang Mang, began recruiting valiant and talented individuals across the country to help his brother consolidate power. From Fufeng Maoling (present-day northeast of Xingping, Shaanxi), two men were selected by Wang Lin: Ma Yuan and Yuan She. Ma Yuan's ancestor was Zhao She, a great general of the Zhao state during the Warring States period. After Zhao was conquered by the Qin state, the descendants of the Zhao clan changed their surname to Ma, adopting the title "Lord of Mafu" from Zhao She's honorific name, to evade persecution by the Qin king.
Wang Lin recommended Ma Yuan and Yuan She to Wang Mang, and both were appointed as Grand Administrators of Zhenrong (the Xin Dynasty renamed the Grand Administrator as Grand Administrator) and Xincheng (present-day Ankang, Shaanxi). After the Xin Dynasty fell, Ma Yuan and his brother Ma Yuan fled to Liangzhou to avoid the turmoil. When Liu Xiu established the Eastern Han Dynasty, Ma Yuan went to join him and received an official position, while Ma Yuan was detained in Xizhou.
At that time, the Western Province was occupied by Wei Xiao, who proclaimed himself Grand General of the Western Province and appointed Ma Yuan as the Suide General, holding Ma Yuan in high regard. Wei Xiao hoped to pledge allegiance to a reliable ruler, and coincidentally, Gongsun Shu had declared himself emperor in the Shu region. Since Ma Yuan and Gongsun Shu were from the same hometown, Wei Xiao sent Ma Yuan to Shu Commandery to gather intelligence.
When Ma Yuan arrived in Shu Commandery, he had expected a warm welcome from Gongsun Shu, but instead found that after becoming emperor, Gongsun Shu had grown arrogant and overbearing. Before meeting Ma Yuan, Gongsun Shu ordered soldiers to line up in the hall and had the hall lavishly decorated before finally inviting Ma Yuan in. After Ma Yuan entered and performed a single bow, barely exchanging a few words, Gongsun Shu had his attendants send him to rest at an inn outside. Then he summoned tailors to make clothes and a hat for Ma Yuan. Once the garments were ready, Gongsun Shu held a grand banquet in the ancestral temple, bringing all his civil and military officials to welcome Ma Yuan. To display his own exalted status, Gongsun Shu made the welcome ceremony extremely elaborate, putting on an air of superiority. During the feast, Gongsun Shu boasted at length, while his ministers flattered him with sycophantic smiles, and Ma Yuan listened quietly. Later, Gongsun Shu offered to enfeoff Ma Yuan as a marquis and appoint him as a great general. These words delighted Ma Yuan's attendants, who thought Gongsun Shu was a wise ruler. But Ma Yuan coldly said to his followers, "When the Duke of Zhou spat out his meal, the whole world turned to him. Gongsun Shu, with his pride and arrogance, will surely not last long."
After returning to Xizhou, Ma Yuan told Wei Xiao that Gongsun Shu was not an emperor with grand ambitions who could be relied upon, so Wei Xiao abandoned the idea of submitting to Shu.
In the year 28 AD, Ma Yuan, acting on orders from Wei Xiao, went to the Eastern Han court to meet Emperor Guangwu. Liu Xiu said happily, "I have long heard of your great reputation, and now that I meet you, you are truly extraordinary." Ma Yuan found this strange and asked, "Your Majesty, how can you be so sure that I am Ma Yuan and not an assassin?" Emperor Guangwu replied, "You have the look of a man who serves the nation and its people—how could you be an assassin?" From that moment on, Ma Yuan wholeheartedly recognized Liu Xiu as an excellent emperor. Emperor Guangwu Liu Xiu also greatly appreciated Ma Yuan, keeping him by his side during southern tours, appointing him as a court attendant awaiting orders, and frequently consulting him on matters of state governance.
When Ma Yuan was preparing to return to Xizhou, Emperor Guangwu was reluctant to let him go but found it inappropriate to insist on his staying, so he sent the Grand Master of Ceremonies to hold a grand farewell ceremony to see him off. After returning to Xizhou, Ma Yuan reported to Wei Xiao everything he had learned in the Eastern Han and urged Wei Xiao to submit to the Eastern Han court, to which Wei Xiao agreed. As a gesture of sincerity, Wei Xiao sent his son Wei Xun to Luoyang as a hostage, and Ma Yuan also brought his family to Luoyang.
However, Ma Yuan waited in Luoyang for a long time but never saw Wei Xiao arrive. It turned out that Wei Xiao had been swayed by his subordinate Wang Yuan, who urged him to seize the Longxi region and declare himself emperor. Ma Yuan immediately wrote a letter advising Wei Xiao to abandon this idea. But Wei Xiao instead believed that Ma Yuan had betrayed him and openly opposed the Eastern Han Dynasty. Left with no choice, Ma Yuan submitted a memorial to Emperor Guangwu, stating that he had originally come to align with the Han court on Wei Xiao's orders, that he was utterly loyal to Emperor Guangwu, and that he was willing to give his all for the Eastern Han. However, now that Wei Xiao had been led astray by evil men, become an enemy of the Han, and even vented his anger on Ma Yuan, it deeply saddened him. If Emperor Guangwu did not despise him, Ma Yuan begged to remain in the Eastern Han. Moved by Ma Yuan's sincerity, Emperor Guangwu allowed him to stay in Luoyang. Later, when Emperor Guangwu fought against Wei Xiao, it was Ma Yuan who devised the strategies. Unable to defeat the Eastern Han army, Wei Xiao fled to the Shu region and allied with Gongsun Shu to jointly resist the Han.
In the year 32 AD, Wei Xiao attacked Lüeyang, and the city's defending officers fought desperately to hold it. Liu Xiu led his forces to reinforce them, but his generals believed they should camp at a distance, fearing that being too close would be dangerous. Just then, Ma Yuan arrived with his troops, and Liu Xiu urgently asked him for advice. After analyzing the situation, Ma Yuan decisively ordered an encirclement of Wei Xiao's army outside Lüeyang the next morning, catching them off guard. As expected, Wei Xiao's forces scattered in all directions under the fierce assault of the Han army, and Wei Xiao himself barely escaped the encirclement. This battle inflicted heavy losses on him, and his power never recovered.

In 33 AD, Ma Yuan was appointed Grand Palace Attendant, led troops to recover Liangzhou, and was recommended as its local governor.
In the year 35 AD, Ma Yuan served as the Governor of Longxi. That summer, the Qiang tribe invaded the Central Plains, and Ma Yuan led three thousand cavalry to counterattack, capturing over eight thousand enemies and recovering the grain and livestock seized by the Qiang. However, he was also wounded in battle. Emperor Guangwu of Han rewarded him with substantial wealth and issued an imperial decree commending his achievements.
In 36 AD, Emperor Guangwu led his army to attack Shu Commandery; Gongsun Shu was severely wounded in the war and died shortly after, and the Shu region was finally brought under the administration of the Eastern Han Dynasty. The long period of division and warfare finally came to an end.
Ma Yuan made significant contributions during Emperor Guangwu's unification of the Central Plains, yet he never became arrogant due to his remarkable achievements. He always treated his subordinates and servants with humility and harmony, and even encouraged his officials to supervise his work. As a result, Ma Yuan was well-liked and highly respected in the court. Combined with his resourcefulness, he naturally earned Emperor Guangwu's appreciation and trust.
In 41 AD, a rebellion broke out in Jiaozhi Commandery, and Ma Yuan petitioned the emperor for permission to lead an expedition. By 43 AD, Ma Yuan had killed most of the rebel forces in Jiaozhi, captured many soldiers, and also killed the rebel leader. When the news reached Luoyang, Emperor Guangwu enfeoffed Ma Yuan as the Marquis of Xinxi, bestowed a large amount of wealth upon him, and distributed much money to the soldiers. After Ma Yuan led his army back to the capital in victory, Emperor Guangwu also rewarded him with an elaborately crafted war chariot for battle.
In the year 47 AD, a tribe called the Five Streams Barbarians in Wuling (west of present-day Changde, Hunan) rose up and attacked the Eastern Han Dynasty. Ma Yuan was already over sixty years old at the time, so Emperor Guangwu planned to send someone else to lead the expedition. Unexpectedly, upon hearing the news, Ma Yuan donned his full armor, rushed hastily to the imperial hall, stood before the emperor, and said, "Your old servant still has the strength to lead troops into battle. A man's ambition reaches the four corners of the world; please allow me, Your Majesty, to make one final contribution to the state." Ma Yuan's fully armed appearance showed no signs of age or weakness, and Emperor Guangwu once again admired him, granting his request.
Ma Yuan lived up to expectations and returned in triumph, but fell seriously ill on the journey and died soon after.
Ma Yuan can be counted among the founding heroes of the Eastern Han Dynasty; most of his life was spent in warfare, dedicating his passion to the country, worthy of learning from and admiration by later generations. When Ma Yuan entered the Eastern Han court, he relied entirely on his own abilities—he neither sought recommendations nor stooped to flattery, climbing step by step to high positions through sheer merit; even as a high-ranking official, he remained approachable and unpretentious, which was truly rare.