After a long and heroic war of attrition against the Qing army, Ma Hualong's criminal Jinjibao base finally ran out of food reserves. By September 1870, Liu Jintang had conquered only a dozen of the more than 500 pillboxes around Jinji Fort. In order to strengthen the attack, Liu Jintang shipped Krupp siege guns imported from Germany from Shanghai, and equipped them with a number of experienced gunner officers. Although the shells failed to blast through the walls of Jinjibao, which were said to be 35 feet thick, Liu Jintang Ren set up a cannon position in October and successfully fired the shells into the city.
The rebels at Jinjibao are in a desperate situation, relying on grassroots and the remains of the dead to feed themselves. In an unbearable predicament, Ma Hualong surrendered to Liu Jintang in January, handing over 46 mountain guns, 293 earth cannons, 1,030 shotguns and 180 foreign guns. Zuo Zongtang put on hold the execution of Ma Hualong for the time being, hoping that he would be able to persuade the other Gansu Hui to surrender. However, no important chieftain was willing to come out and surrender.
When the Qing army found more than 1,200 foreign guns hidden in Jinji Fort, Zuo Zongtang angrily ordered Ling Chi to execute Ma Hualong and his adult male relatives. About 800 rebel staff officers and officers, as well as 1,000 soldiers, were executed. 140,000 able-bodied residents, including as many as 110,000 Hui from Shaanxi, were relocated to the vicinity of Pingliang. The families of 20,000 rebels were sent to refugee camps in southern Gansu. The Qing army was given permission to loot property in the fort. At the same time, those raiders from northern Shaanxi who had surrendered to Liu Songshan in 1869, of Han Chinese descent, were encouraged by Zuo Zongtang to bring their families to settle in Jinjibao, transforming it into a Han town.