William McKinley Jr. (January 29, 1843 – September 14, 1901) was the 25th president of the United States from 1897 to 1901, and the last veteran of the American Civil War to be elected to the presidency. He was the last American president to serve in the 19th century and was the first president to serve in the 20th century. He spent much of his adult life in politics and was a six-term congressman, and was also the governor of Ohio before defeating William Jennings Bryan for the Presidency (1897–1901). McKinley was assassinated early in his second term while attending the Pan-American Exposition in Buffalo in 1901.