 He was professor of law at the U.S. Military Academy from 1878 until 1882, when he was assigned to duty in Washington in the Bureau of Military Justice.In 1884 he was appointed Assistant Judge Advocate General, with the rank of colonel, and was on duty as Acting Judge Advocate General of the U.S. Army.In 1895, he was promoted to brigadier general and served as Judge Advocate General until 1901, in which capacity he was one of the most valuable advisers of President William McKinley during the Spanish–American War.