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. Madison,
the fourth United States president,
took office after defeating Federalist Charles Cotesworth Pinckney decisively in the 1808 presidential election.
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's presidency was dominated by the effects of the ongoing Napoleonic Wars. Initially,
American merchants had benefited from the war in Europe since it allowed them to increase their shipping activities,
but both the British and French began attacking American ships in an attempt to cut off trade.
In response to persistent British attacks on American shipping and the British practice of impressment,
the United States declared war on Britain,
beginning the War of 1812.
The war was an administrative morass,
as the United States had neither a strong army nor financial system,
and the United States failed to conquer Canada. In 1814,
the British entered Washington and set fire to the White House and the Capitol. However,
the United States won several notable naval victories and crushed the resistance of British-allied Native Americans in the West.
Shortly after the American triumph at the Battle of New Orleans,
the war ended with the ratification of the Treaty of Ghent,
in which neither party made major concessions.
Despite the lack of gains in the war,
the timing of the treaty convinced many Americans that the United States had won a great victory in the war,
and Madison's popularity grew.
The Federalists collapsed as a national party in the aftermath of the war,
which they had strongly opposed.
Madison entered office intending to continue the limited government legacy of his Democratic-Republican predecessor, Thomas Jefferson. However,
in the aftermath of the war,
Madison favored higher tariff,
increased military spending,
and the establishment of the Second Bank of the United States.
Despite opposition from strict constructionists like John Randolph,
much of Madison's post-war agenda was enacted.
Madison left office highly popular,
and his chosen successor, James Monroe,
was elected with little opposition.
Historians tend to be critical of Madison's presidency,
especially of his handling of the War of 1812. 
