War of 1812
Congress had repealed the Embargo Act of 1807 shortly before Madison became president, but troubles with the British and French continued. Madison settled on a new strategy that was designed to pit the British and French against each other, offering to trade with whichever country would end their attacks against American shipping. The gambit almost succeeded, but negotiations with the British collapsed in mid-1809. Seeking to drive a wedge between the Americans and the British, Napoleon offered to end French attacks on American shipping so long as the United States punished any countries that did not similarly end restrictions on trade. Madison accepted Napoleon's proposal in the hope that it would convince the British to finally end their policy of commercial warfare. Notwithstanding, the British refused to change their policies, and the French reneged on their promise and continued to attack American shipping.
With sanctions and other policies having failed, Madison determined that war with Britain was the only remaining option. Many Americans called for a "second war of independence" to restore honor and stature to their new nation, and an angry public elected a "war hawk" Congress, led by Henry Clay and John C. Calhoun. With Britain already engaged in the Napoleonic Wars, many Americans including Madison believed that the United States could easily capture Canada, using it as a bargaining chip for other disputes or simply retaining control of it. On June 1, 1812, Madison asked Congress for a declaration of war, stating that the United States could no longer tolerate Britain's "state of war against the United States". The declaration of war was passed along sectional and party lines, with opposition to the declaration coming from Federalists and from some Democratic–Republicans in the Northeast. In the years prior to the war, Jefferson and Madison had reduced the size of the military, leaving the country with a military force consisting mostly of poorly trained militia members. Madison asked Congress to quickly put the country "into an armor and an attitude demanded by the crisis", specifically recommending expansion of the army and navy.
Given the circumstances involving Napoleon in Europe, Madison initially believed the war would result in a swift American victory. Madison ordered three landed military spearhead incursions into Canada, beginning from Fort Detroit, aimed to loosening British control around American-held Fort Niagara and destroying the British supply lines from Montreal. These actions were intended to gain leverage for concessions to protect American shipping in the Atlantic. Without a standing army, Madison counted on regular state militias to rally to the flag and invade Canada; however, governors in the Northeast failed to cooperate. The British army was more organized, utilized professional soldiers, and fostered an alliance with Native American tribes led by Tecumseh. On August 16, during the British siege of Detroit, Major General William Hull panicked after the British fired on the fort and killed two American officers. Terrified of a Native American massacre, drinking heavily, Hull quickly ordered a white tablecloth out a window and unconditionally surrendered Fort Detroit and his entire army to British Major-General Sir Isaac Brock. Hull, later, was court-martialed for cowardice, but Madison intervened and saved him from execution. On October 13, a separate force from the United States was defeated at Queenston Heights, although Brock was killed. Commanding General Henry Dearborn, hampered by mutinous New England infantry, retreated to winter quarters near Albany, failing to destroy Montreal's vulnerable British supply lines. Lacking adequate revenue to fund the war, the Madison administration was forced to rely on high-interest loans provided by bankers in New York City and Philadelphia.
In the 1812 presidential election, held during the early stages of the war, Madison was re-nominated without opposition. A dissident group of New York Democratic-Republicans nominated DeWitt Clinton, the lieutenant governor of New York and a nephew of the recently deceased Vice President George Clinton, to oppose Madison in the 1812 election. This faction of Democratic-Republicans hoped to unseat the president by forging a coalition among Democratic-Republicans opposed to the impending war, as well as those party faithful angry with Madison for not moving more decisively toward war, northerners weary of the Virginia dynasty and southern control of the White House, and many New Englanders wanted Madison replaced. Dismayed by their prospects of beating Madison, a group of top Federalists met with Clinton's supporters to discuss a strategy for unification. Difficult as it was for them to join forces, they nominated Clinton for President and Jared Ingersoll, a Philadelphia lawyer, for vice president. Hoping to shore up his support in the Northeast, where the War of 1812 was unpopular, Madison selected Governor Elbridge Gerry of Massachusetts as his running mate, though Gerry would only survive two years after the election due to old age. Despite the maneuverings of Clinton and the Federalists, Madison won re-election, though by the narrowest margin of any election since that of 1800 in the popular vote, as later supported by the electoral vote as well. He received 128 electoral votes to 89 for Clinton. With Clinton winning most of the Northeast, Madison won Pennsylvania in addition to having swept the South and the West, which ensured his victory.
After the disastrous start to the war, Madison accepted Russia's invitation to arbitrate and sent a delegation led by Gallatin and John Quincy Adams (the son of former President John Adams) to Europe to negotiate a peace treaty. While Madison worked to end the war, the United States experienced some impressive naval successes, by the USS Constitution and other warships, that boosted American morale. Victorious in the Battle of Lake Erie, the U.S. crippled the supply and reinforcement of British military forces in the western theater of the war. General William Henry Harrison defeated the forces of the British and of Tecumseh's confederacy at the Battle of the Thames. The death of Tecumseh in that battle marked the permanent end of armed Native American resistance in the Old Northwest and any hope of a united Indian nation. In March 1814, Major General Andrew Jackson broke the resistance of the British-allied Muscogee Creek in the Old Southwest with his victory at the Battle of Horseshoe Bend. Despite these successes, the British continued to repel American attempts to invade Canada, and a British force captured Fort Niagara and burned the American city of Buffalo in late 1813.
On August 24, 1814, the British landed a large force on the shores of Chesapeake Bay and routed General William H. Winder's army at the Battle of Bladensburg. Madison, who had earlier inspected Winder's army, escaped British capture by fleeing to Virginia, though the British captured Washington and burned many of its public buildings, including the White House. Dolley bravely secured the portrait of George Washington, before she abandoned the White House, escaped British capture, and fled to Virginia. The charred remains of the capital signified a humiliating defeat for James Madison and America. On August 27, Madison returned to Washington to view the carnage of the city. Dolley returned to the capital the following day. On September 8, the Madisons moved into the Octagon House. The British army next advanced on Baltimore, but the U.S. repelled the British attack in the Battle of Baltimore, and the British army departed from the Chesapeake region in September. That same month, U.S. forces repelled a British invasion from Canada with a victory at the Battle of Plattsburgh. The British public began to turn against the war in North America, and British leaders started to look for a quick exit from the conflict.
In January 1815, Jackson's troops defeated the British at the Battle of New Orleans. Just over a month later, Madison learned that his negotiators had finalized the Treaty of Ghent on December 24, 1814, which ended the war. Madison promptly sent the treaty to the Senate, which ratified it on February 16, 1815. Although the overall outcome of the war resulted in a standoff, the rapid succession of events at the war's conclusion, including the burning of the capital, the Battle of New Orleans, and the Treaty of Ghent, made it seem as though American bravery at New Orleans had compelled the British to surrender. This perspective, although inaccurate, significantly contributed to enhancing Madison's reputation as president. Napoleon's defeat at the June 1815 Battle of Waterloo marked a definitive end to the Napoleonic Wars and thus concluded the hostile seizure of American shipping by British and French forces.