He was the eldest son of John Adams, who served as the second US president from 1797 to 1801, and First Lady Abigail Adams. Initially a Federalist like his father, he won election to the presidency as a member of the Democratic-Republican Party, and in the mid-1830s became affiliated with the Whig Party. The Anti-Masonic Party nominated Adams in the 1833 Massachusetts gubernatorial election in a four-way race between Adams, the National Republican candidate, the Democratic candidate, and a candidate of the Working Men's Party. The National Republican candidate, John Davis, won 40% of the vote, while Adams finished in second place with 29%. Adams was nearly elected to the Senate in 1835 by a coalition of Anti-Masons and National Republicans, but his support for Jackson in a minor foreign policy matter annoyed National Republican leaders enough that they dropped their support for his candidacy. After 1835, Adams never again sought higher office, focusing instead on his service in the House of Representatives.