James Madison won the U.S. presidential election of 1808, largely on the strength of his abilities in foreign affairs at a time when Britain and France were both on the brink of war with the United States.