Prior to that, Ma Yuan contributed to Emperor Guangwu's defeat of the warlord Wei Xiao (隗囂), who controlled the modern eastern Gansu region.
A few months later, Lai Xi was killed on campaign against Gongsun Shu, but his assistant, Ma Yuan, Grand Administrator of Lonxi commandery, continued operations against the Qiang.
In the two separate campaigns, Ma Yuan captured more than ten thousand head of horses, cattle and sheep, together with considerable stores of grain.
He was wounded in the leg during one of the final engagements, and he did not completely destroy the enemy, but he did drive them away from the valley lands of Jincheng, and he was rewarded with Imperial commendation and several thousand of the animals he had captured.
Though members of the Qiang had escaped across the borders, Ma Yuan's victories in 35 had broken the power of the Xianlian tribe and had made possible a restoration of Chinese positions on the old frontiers.
[1] In 49 while on expedition against the Wulin tribes (in modern eastern Guizhou and northwestern Hunan), Ma died from a plague which also killed a large number of his soldiers.
[5][7][8][9] Historian Olga Dror suggests two alternative possibilities: that Bạch Mã was originally worshipped by older Chinese and Kinh communities at the temple before newer waves of Chinese settlers from the 17th century onwards merged the two; or that Ma Yuan was originally worshipped at the temple before it fell into obscurity after the Third Era of Northern Domination to be replaced by the cult of Bạch Mã.
[7][5][6] In the Romance of the Three Kingdoms, Zhuge Liang was inspired by a temple of Ma Yuan en route to overcoming the rebellion of Meng Huo and the Nanman.