James Buchanan Jr. (; April 23, 1791 – June 1, 1868) served as the 15th president of the United States from 1857 to 1861, serving directly prior to the American Civil War. A member of the Democratic Party for much of his career, Buchanan served as Secretary of State and represented Pennsylvania in both houses of the U.S. Congress before becoming president. Buchanan faced two candidates in the general election: former Whig President Millard Fillmore ran as the American Party (or 'Know-Nothing') candidate, while John C. Frémont ran as the Republican nominee. Buchanan did not actively campaign, but he wrote letters and pledged to uphold the Democratic platform. In the election, Buchanan carried every slave state except for Maryland, as well as five free states, including his home state of Pennsylvania. He won 45 percent of the popular vote and, most importantly, won the electoral vote, taking 174 electoral votes compared to Frémont's 114 electoral votes and Fillmore's 8 electoral votes.