Arriving in India on 12 February 1858, Elsmie was appointed assistant commissioner in the Punjab, and served in various districts until 1863, when he acted as a judge of the small causes courts at Lahore, Delhi, and Simla. In March 1865 he became deputy commissioner of Jullundur, and in October 1868 under-secretary to the government of India in the home department. Taking furlough in the spring of 1869, he entered Lincoln's Inn as a student, and was called to the bar on 27 January 1871. Returning to India, Elsmie was appointed additional commissioner of the Amritsar and Jullundur divisions, his duties being almost entirely judicial. In October 1872 he was transferred to Peshawur, the lieutenant-governor wishing to improve the judicial administration and reduce crimes of violence in the district. He left there in January 1878 to officiate as judge of the Punjab chief court for a year. After furlough in December 1880 Elsmie became commissioner of Lahore, and in April 1882 was appointed permanently to the chief court bench. In the same year he served on the Punjab re-organisation committee. In agreement with its recommendations the Lahore commissionership was enlarged in area and relieved of judicial appellate work, and Elsmie was appointed again in February 1885. He was on special duty for the Rawalpindi durbar for Lord Dufferin to meet the Amir Abdur Rahman Khan and was vice-chancellor of Punjab University. Elsmie was made second financial commissioner in April 1887, a member of the governor-general's legislative council in May 1888, and first financial commissioner from March 1889. He was re-appointed to the governor-general's legislative council in June 1892, and was made Companion of the Order of the Star of India in January 1893.
Later life
Elsmie left India on 4 February 1894. On 20 July 1904 he received from Aberdeen University the honorary degree of LL.D. He died at Torquay on 26 March 1909, and was buried at Deeside cemetery, Aberdeen.
Works
Elsmie prepared an Epitome of Correspondence regarding our Relations with Afghanistan and Herat, 1854-63. Suggestions to the government in Crime and Criminals on the Peshawur Frontier contributed to the Frontier Criminal Regulations. With Peter Lumsden, Elsmie wrote Sir Harry Lumsden's biography, Lumsden of the Guides. With material collected by Sir Henry Cunningham he wrote the authorised life of Field-marshal Sir Donald Stewart, and he edited letters of his mother as Anne Shepherd or Elsmie: a Character Sketch of a Scottish Lady of the Nineteenth Century as disclosed by her Letters. Thirty-Five Years in the Punjab was dedicated to his university.
Family
Elsmie married at Southampton, on 27 October 1861, Elizabeth, youngest daughter of Thomas Spears of Kirkcaldy, who survived him. Of a family of three sons and eight daughters, two sons became officers in the Indian army, four daughters married Indian civil servants, one of the husbands being Thomas Holderness, and two daughters married officers in the army.