Commanding general of the U.S. Army from 1841-1861, he was a presidential candidate for the Whig Party in 1852. He was promoted to brigadier general as a result of his actions in the War of 1812. Later in 1814 he was promoted to brevetted major general for his bravery at the Battle of Lundy's Lane, where he was twice wounded. In 1846 he was ordered by President James K. Polk to command the invasion of Mexico. His forces successfully stormed Veracruz on March 26, 1847 with only 20 casualties. His military campaign continued and he captured Mexico City on September 14, for which he was awarded his second gold medal by the U.S. Congress. In 1848 he lost the Whig presidential nomination, but won it four years later. He lost in the presidential election to Democrat Franklin Pierce. At the beginning of the Civil War he commanded the defense of Washington, D.C., but resigned because of age in November 1861.