Ma was transferred along with his brother Ma Fulu and several cousins as officers under Gen. Dong Fuxiang to Beijing in 1898. During the Boxer Rebellion, the Muslim troops came to be known as the "Kansu Braves" and fought against the Eight Nation Alliance. Ma Fuxiang killed many foreigners in combat. Ma led a cavalry charge against the foreign Eight Nation Alliance army at the Battle of Langfang, defeating them and forcing the Europeans to flee. He and Ma Fulu personally planned and led the attack, encircling the foreign troops with a pincer movement. The foreign invasion of Beijing was derailed by their efforts for another month. The Muslim troops engaged in fierce fighting at Zhengyang Gate in Beijing. Ma Fulu, and four of his cousins were killed in action in 1900 in Beijing during the Battle of Peking (1900), in total one hundred soldiers from his home village died in that battle at Zhengyang. He had commanded a brigade, and Ma Fuxiang took over the position after his brother's death. For the rest of the Boxer Rebellion his unit engaged in the Siege of the International Legations (Boxer Rebellion). He escorted the imperial family to Xi'an.