He served as a Free Soiler in the Massachusetts house of representatives from 1849 to 1853, and was speaker in 1851 and 1852; he was president of the state Constitutional Convention of 1853, and in the same year was elected to the national House of Representatives as a coalition candidate of Democrats and Free Soilers.
He served in the lower house of the state legislature in 1826-1828, and from December 1838 until March 1859 was a member of the national House of Representatives, first as a Whig, then as a Free-soiler, and finally as a Republican.
With ardent anti-slavery principles, he entered political life as a "Young Whig" opposed to the Mexican War; he became an active Free-Soiler in 1848, and in 1854 took part in the organization in Massachusetts of the new Republican party.