In 1851, Polk challenged the Democratic incumbent, James H. Thomas, for the party's nomination for the 6th district's seat in the U.S. House of Representatives. Failing in this, he ran against Thomas in the general election as an Independent Democrat, winning by a small margin. While in Congress, he opposed any attempts to tamper with or modify the Fugitive Slave Act, and opposed the promotion of General Winfield Scott, recalling Scott's earlier attacks against Andrew Jackson. After the Whig-dominated state legislature gerrymandered his district, Polk declined to seek reelection in 1853.