In the middle of the 19th century, class and ethnic conflicts in the country were exceptionally sharp, and peasant revolts and anti-Qing uprisings of ethnic minorities broke out all over the country. Under the influence of the Taiping Heavenly Kingdom Revolution and the Twisting Army Uprising, in the first year of the Tongzhi reign (1862), the Hui anti-Qing incident initiated by the Hui people in Shaanxi and followed up by the Hui people in Gansu broke out in the northwest, and the beacon fire spread over most of the areas of Shaanxi and Gansu for 12 years, which is also known as the Tongzhi Hui Rebellion.
Shaanxi is one of the more concentrated areas of the Hui people (mainly distributed in the Jingshui and Weishui basins), the province's Hui population of about one million people. 1862, May, the Taiping Army Fu Wang Chen De Cai Department entered Shaanxi, in Shaanxi, the Qing army in the blocking of the Taiping Army at the same time, the Huazhou Hui first uprising, the West Bank of the Weihe River Hui people responded to the anti-Qing Dynasty, the beacon of the anti-Qing Dynasty quickly burned 400 kilometers Qin River, anti-Qing Dynasty Hui peasant uprising army expanded to more than 200,000 troops. The anti-Qing Hui peasant insurgent army expanded to more than 200,000 people. In October 1863, the Qing army adopted a two-handed strategy of "suppression and pacification", which caused the Shaanxi Hui peasant insurgents to suffer great losses. A part of the Hui peasant insurgents moved to the eastern part of Gansu to continue their struggle.
Shaanxi Hui peasant uprising at the beginning of the uprising, Gansu Hui people have responded to the beginning of 1864, Shaanxi Hui people into Gansu, Hui peasant uprising more powerful. In the repeated struggles with the Qing army, four centers of anti-Qing struggles were gradually formed in Gansu: the military area centered on Jinjibao under the leadership of Ma Hualong, the military area centered on Hezhou under the leadership of Ma Zhanao, and the military area centered on Suzhou (present-day Jiuquan) under the leadership of Ma Wenlu. Under the blows of the Hui peasant insurgents, the Qing Dynasty's rule in Gansu was in a precarious state. Shaanxi and Gansu Governor Yang Yuebin, Liu Songshan Department of the old Hunan army in the Hui peasant insurgent army and the western twisted army into Shaanxi under the joint attack, a helpless and helpless.
Because Yang Yuebin on the suppression of Shaanxi and Gansu Hui peasant revolt has no way, the Qing government sent another governor of Fujian and Zhejiang, Zuo Zongtang as governor of Shaanxi and Gansu, Minister of the Imperial Household, supervise the military affairs of Shaanxi and Gansu. Zuo Zongtang determined the "first Qin and then Long" approach to combat.
July 1867, Zuo Zongtang rate of the Xiang army nearly 20,000 people arrived in Shaanxi, Shaanxi Hui peasant insurgents step by step, each breakthrough, so that the Shaanxi Hui insurgents suffered heavy losses.
November 1868, Zuo Zongtang to Shaanxi has been finalized, it will step up preparations for the march into Gansu, the formulation of the "three ways to advance the policy", in three ways to Gansu:
Liu Songshan rate of the Department of Suide westward, pointing to the Jinjibao, the North Road; Li Yaonan, Wu Shimai rate of the Longzhou, Baoji, tend to Qinzhou, is the South Road. Tend to Qinzhou, is the South Road; Zuo Zongtang and Liu Dian led troops from Qianzhou through the Duke, Changwu to Jingzhou, is the Middle Road. Among them, the north road is the key direction of attack.
Jinji Fort is located more than 25 kilometers southwest of Lingzhou, east to Huamachi, south to Guyuan, west to the Yellow River, is the military core of the Hui peasant insurgent army of Ma Hualong Department.
Zuo Zongtang, after making all the preparations, attacked the Gansu Hui peasant rebel army in force.