The presidency of James Madison began on March 4, 1809, when James Madison was inaugurated as President of the United States, and ended on March 4, 1817. He was re-elected four years later, defeating DeWitt Clinton in the 1812 election. His presidency was dominated by the War of 1812 with Britain. Madison was succeeded by Secretary of State James Monroe, a fellow member of the Democratic-Republican Party. Madison replaced him with William H. Crawford until 1814 and then former Treasury Secretary Albert Gallatin. For Spain Madison kept Chargé d'Affaires George W. Erving, a holdover from the Jefferson administration, raising the post to Minister Plenipotentiary in 1814. For Portugal, Madison appointed Thomas Sumter Jr.. After the disastrous start to the War of 1812, Madison accepted a Russian invitation to arbitrate the war and sent Gallatin, John Quincy Adams, and James Bayard to Europe in hopes of quickly ending the war. While Madison worked to end the war, the U.S. experienced some military success, particularly at sea.