Fujian Fleet
Liu's fortunes were transformed by the outbreak of the Sino-French War in August 1884. The Empress Dowager Cixi responded to the news of the destruction of China's Fujian Fleet at the Battle of Fuzhou (23 August 1884) by ordering her generals to invade Tonkin to throw the French out of Hanoi. Tang Jingsong, the commander of the Yunnan Army, knew that Liu's services would be invaluable in the war with France. Although Liu had bitter memories of his previous service as an ally of China, he respected Tang (the only Chinese commander to have contributed troops to the defence of Sơn Tây), and agreed to take part with the Black Flag Army in the forthcoming campaign. Appointed a divisional general in the Yunnan Army, Liu helped the Chinese forces put pressure on Hưng Hóa and the isolated French posts of Phu Doan and Tuyên Quang during the autumn of 1884. In the winter and spring of 1885 he commanded 3,000 soldiers of the Black Flag Army during the Siege of Tuyên Quang. At the Battle of Hòa Mộc (2 March 1885), the Black Flag Army inflicted heavy casualties on a French column marching to the relief of Tuyên Quang.