Trained as a lawyer, Webster was elected to the U. S. House of Representatives in 1812, thereby beginning a distinguished political career that would span four decades and would greatly impact the direction the U.S. would take in the future. He was a member of the U.S. Senate 1827-1841 and 1845-1850, and served as U.S. Secretary of State under Presidents Harrison, Tyler and Fillmore (1841-1843 and 1850-1852). Webster's numerous tenures as Secretary of State were marked by many successes, foremost among them the Webster-Ashburton Treaty (1842) which avoided a war with Great Britain by settling a boundary dispute between Canada and Maine. Webster's greatest fame, however, arose from his service in the Senate. His response to Senator Robert Hayne's nullification speech cemented his reputation as a great orator, and his role in the nullification crisis of 1832-33 and in the passage of the Compromise of 1850 earned him the title of "defender of the constitution."