In 1900 the Boxer Rebellion broke out, and Zhang's gang joined the imperial army. In peacetime he hired his men out as security escorts for traveling merchants. In the Russo-Japanese War of 1904–05 the Japanese Army employed Zhang and his men as mercenaries. At the end of the Qing dynasty Zhang managed to have his men recognised as a regiment of the regular Chinese army, patrolling the borders of Manchuria and suppressing other bandit gangs. The American surgeon Louis Livingston Seaman met Zhang during the Russo-Japanese War, and took several photographs of him and his troops as well as writing an account of his journey.