Not having been politically involved or written in newspapers, he was nevertheless elected as a Whig to the Massachusetts House of Representatives in 1842 and 1843. He was chairman of the House Standing Committee on Education, working closely with Horace Mann. During his second term, however, the Whigs were in the minority, leading to several legislative disappointments, so he sought state office instead of re-election to the House. He became Massachusetts Secretary of the Commonwealth, a post he held from 1844 to 1848. As secretary, a largely ceremonial position, he introduced statistical tables which set a new standard for the state, organized the Revolutionary War records to better answer pension claims, and organized the state's 14,000 volumes and 40,000 pamphlets of written records.