The War of 1812 was a near disaster for the United States. An invasion of British Canada in 1812 quickly ended in a retreat to Detroit. Nonetheless, the United States stayed on the offensive in the West. In 1813, American raiders burned the Canadian capital of York, Commodore Oliver Hazard Perry defeated a small British flotilla on Lake Erie and General William Henry Harrison overcame a British and Indian force at the Battle of the Thanes, taking the life of Tecumseh. In the East, political divisions prevented a wider war. New England Federalists opposed the war and prohibited their states' militias from attacking Canada. As a minority party, the Federalists could prevail only if the war continued to go badly. But when a few months later came by, thousands of seasoned British troops landed outside New Orleans and threatened American control of the Mississippi River, and with the nation politically divided, the war might prove vitally fatal to the United States. However, the British had fortunately sought peace with the United States, which will lead to the Treaty of Ghent.