 He was a delegate to the Republican National Conventions in 1868, 1872, and 1876; appointed United States centennial commissioner for the State of Massachusetts in 1872; elected as a Republican to the Forty-fifth and Forty-sixth Congresses (March 4, 1877 – March 3, 1881).He was an unsuccessful candidate for renomination in 1880.Made United States Commissioner of Agriculture (1881–1885); appointed United States Minister to Portugal in 1889 and served until his resignation in 1890.