Brigadier-General Charles Arbuthnot, when he took part in the advance to Kata Sang in late 1879, and in December was present at Pezwan during the disturbances there, before accompanying the Hissarak valley expedition in April 1880. For his services in the Afghan War, Stafford was awarded the Afghanistan Medal and mentioned in dispatches. Stafford returned to Afghanistan with the Bengal Sappers & Miners in April 1881, as part of the Second Column of the Mahsud-Waziri Expeditionary Force under the command of Brigadier-General John James Hood Gordon. This was an attempt to subdue the Waziri tribesman who had frequently attacked the British settlement at Tank close to the Indian border with Afghanistan, the "North-West Frontier". For his services on the expedition, Stafford was again mentioned in despatches. In October 1882, Stafford returned to England, taking up the post of Assistant Instructor in Survey at the School of Military Engineering at Chatham in March 1883, despite still being a subaltern. He was promoted to captain on 8 January 1885. He remained at the School of Military Engineering until March 1888, when he was posted to Colchester for two years. In April 1890, Stafford was posted to Egypt, remaining there until November 1894, having been promoted to major on 13 November 1892, before a brief posting to Malta, returning to Chatham in March 1895. Over the next four years, he was posted to various bases across the British Isles, including serving at The Curragh in Ireland from October 1886 to January 1899. Stafford was posted to South Africa in October 1899 to serve in the Second Boer War, in command of the 26th Field Company, Royal Engineers, where he participated in the advance on the Boer capital at Bloemfontein, including the engagements at Poplar Grove and Karee Siding in March 1900, after which he was promoted to lieutenant colonel from 14 April 1900, remaining in the Transvaal until August 1902. For his services during the operations in South Africa, Stafford was mentioned in despatches and received the Queen's South Africa Medal with three clasps, and the King's South Africa Medal with two clasps, before being appointed a Companion of the Most Honourable Order of the Bath (C.B.) on 26 June 1902. On his return to the UK, Stafford spent time in command of the Royal Engineers at Victoria Barracks, Cork from October 1902 to January 1903, and Chester, as Commanding Royal Engineer, North-Western