Gallatin returned to Congress in 1795 after winning election to the House of Representatives. He became the chief spokesman on financial matters for the Democratic-Republican Party, leading opposition to the Federalist economic program. Gallatin's mastery of public finance led to his choice as Secretary of the Treasury by President Thomas Jefferson, despite Federalist attacks that he was a "foreigner" with a French accent. Under Jefferson and James Madison, Gallatin served as secretary from 1801 until February 1814. Gallatin retained much of Hamilton's financial system, though he also presided over a reduction in the national debt prior to the War of 1812. Gallatin served on the American commission that agreed to the Treaty of Ghent, which ended the War of 1812. In the aftermath of the war, he helped found the Second Bank of the United States.