Beginning in politics in the mid-1820s, Millard Fillmore was swept up in the anti-Masonic movement in western New York. Elected to the state assembly, he sponsored a bill to end imprisonment for debt. He was elected to the U.S. Congress in 1832, and he joined the Whig Party. He lost as the Whig candidate for governor of New York in 1844. In 1848 the Whigs chose Zachary Taylor as their presidential candidate and added Fillmore to the ticket as balance.
On July 9, 1850, Fillmore succeeded to the presidency on Taylor's death. He committed himself to sectional compromise. His administration strictly enforced the most controversial of the new measures, the Fugitive Slave Law, which required Northerners to collaborate in the return of escaped slaves to their Southern owners.
Fillmore was the first president to approve federal aid for the building of railroads, and the first to send a trade mission to Japan. After 53 ballots in the Whig presidential convention of 1852, Gen. Winfield Scott was named the party's choice for president. Fillmore returned to Buffalo and against sought the presidency in 1856. He won the Whig nomination, but placed third in a three-man race.