James Monroe (; April 28, 1758 – July 4, 1831) was an American statesman, lawyer, diplomat and Founding Father who served as the fifth president of the United States from 1817 to 1825. A member of the Democratic-Republican Party, Monroe was the last president of the Virginia dynasty; his presidency coincided with the Era of Good Feelings. He is perhaps best known for issuing the Monroe Doctrine, a policy of opposing European colonialism in the Americas. He unsuccessfully challenged Madison in the 1808 presidential election, but in April 1811 he joined Madison's administration as Secretary of State. During the later stages of the War of 1812, Monroe simultaneously served as Madison's Secretary of State and Secretary of War. His wartime leadership established him as Madison's heir apparent, and he easily defeated Federalist Party candidate Rufus King in the 1816 presidential election. In foreign affairs, Monroe and Secretary of State John Quincy Adams favored a policy of conciliation with Britain and a policy of expansionism against the Spanish Empire.