As a prominent Muslim in Yunnan, Ma became involved in the Panthay Rebellion in Yunnan shortly after he returned from the Hajj. The Panthay Rebellion, which flared up in 1856 as part of a wider series of uprisings by Muslims and other minorities, was led mainly by Du Wenxiu; though Ma disagreed with Du Wenxiu's revolutionary methods, he also encouraged his followers to aid in the uprising; later, he would try to act as a peacemaker between the central government forces and the rebels. Ma Dexin said that Neo-Confucianism was reconcilable with Islam, approved of Ma Rulong defecting to the Qing and he also assisted other Muslims in defecting.However, despite his efforts to bring about peace, the Qing government still regarded him as a rebel and a traitor; he was executed two years after the suppression of the rebellion. Europeans reported that he was either poisoned or executed.
Sources say that Ma produced the first Chinese translation of the Qur'an, as well as writing numerous books in Arabic and Persian about Islam. His most famous writings compared Islamic culture and the Confucian philosophy in an effort to find a theoretical and theological basis for their coexistence. At the same time, he harshly criticised the absorption of Buddhist and Taoist elements into the practise of Islam in China. As he is generally regarded as an orthodox Islamic thinker, his writings also demonstrated a positive attitude towards Tasawwuf, or Sufi mysticism. In total, he published over 30 books, most of which fall into five categories.
Other: 朝觐途记 (Diary of a pilgrimage), a description of his time in Mecca; originally in Arabic, translated to Chinese by Ma's disciple Ma Anli
Ma Dexin appears to have picked up anti-Shia hatred from his time in the Ottoman lands and referred to them by the derogatory name Rafida 若废子 in his works which attacked and criticized Shias and Sufis. Ma, like other most other Hui in China, belonged to the Hanafi Madhhab of Sunni Islam..