After Japan launched the invasion war into China in 1937, under the leadership of the Chinese Communist Party, all Muslims from various peoples, with the Huis in particular, took an active part in the campaign of fighting against the Japanese invaders and saving the country. The Hui Detachment led by Ma Benzhai was a famous anti-Japanese military force organized spontaneously by the Chinese Muslims. Ma Benzhai was a colonel in the Army of the Northeast. When his hometown was ruined by Japanese, Ma Benzhai raised the standard of revolt against Japanese invasion in the Dongxin Zhuang Mosque, and was followed by many Hui youths. The Hui Detachment with Ma Benzhai himself as commander and Guo Lushun from the Red Army as commissar scored many victories with flexible guerilla tactics. His army soon expanded to 2300 people. Swearing to fight for the country and the people, and have the Japanese pay for their bloody crimes, the Hui Detachment fought in over 870 battles in 6 years, wiping out 36,700 people of the Japanese puppet army, capturing or destroying hundreds of blockhouses and fortified points, railways and bridges, seizing large quantities of firearms, ammunition, war horses and military supplies. For the bravery that the Hui soldiers had shown and the brilliant successes they had achieved, the Hui Detachment was called "iron army that can't be defeated". It left a glorious page in the history of the Chinese people's war of resistance.
The Hui military force initiated by Liu Geping, Wang Lianfang and other intellectuals in the south of Tianjin soon expanded to more than 400 people. Afterwards it was enlarged to be "the Hui Detachment in Hebei and Shandong Border Area", with Liu Zhenhuan as commander and Wang Lianfang as commissar. The Hui Detachment respected the habits and customs of Hui soldiers. There were Imams in the army for slaughtering sheep and cattle to provide Halal meat. On the occasion of the Fast-Breaking Festival, Hui soldiers were allowed to go to the garrison mosque to take part in the holiday activities. Thus it won the confidence and support of the Huis, and its force expanded to over 2000 people. In a period of 5 years from its formation to the end of the war, the Hui Detachment had fought in more than 100 massive battles, capturing over 20 fortified points, wiping out 1300 people of the Japanese puppet army, seizing 20 artilleries, 10 scatter-guns, 1500 rifles and pistols and innumerable military supplies.
Other Hui anti-Japanese forces under the leadership of the Chinese Communist Party appeared during the war of resistance against Japan were: National Anti-Japan Liberation Vanguard founded in Zaozhuang in 1937; the Hui Anti-Japan Army for Saving the Country founded in Cangzhou in the winter of 1937 and led by Liu Zifang (Hui); the Hui Guerrillas founded in Zaozhuang in 1938; the Muslim Battalion founded in Eriong Village, Dingbian County, Anhui Province, in September of 1938;the Hui Guerrillas founded in Liuhezhu Town, Jiangsu Province, in the end of 1939; the Hui Brigade of Military Subarea of the Hebei and Shandong Border founded in 1939; the Hui Anti- Japanese Guerrillas founded in Luoning County in July of 1944, and led by Ding Zhenxing (Hui. also called Ding Laoliu).
On the other hand, some reactionary forces both at home and abroad took advantage of Islam to disintegrate the Muslim military force to realize their political ambition. The Japanese invaders did this most often. Having captured North China, the Japanese plotted and set up the puppet "China Islamic Federation" to control the Huis with their traitors. They created many problems among the peoples of Inner Mongolia and Xinjiang so that they could reap unfair gains. Tsarist Russia attempted vainly to found an independent Islamic country in Xinjiang to destabilize the Northwest frontier of China. Due to the unity of all nationalities in China and the vigilance and determination of Muslims in these regions, the intrigue of the imperialists failed to succeed.