Adams held diplomatic posts for the duration of Madison's presidency, and he served as part of the American delegation that negotiated an end to the War of 1812. In 1817, newly-elected President James Monroe selected Adams as his Secretary of State. In that role, Adams negotiated the Adams–Onís Treaty, which provided for the American acquisition of Florida. During his time in Congress, Adams became increasingly critical of slavery and of the Southern leaders whom he believed controlled the Democratic Party. The State Department charged Adams with developing commercial relations with Prussia and Sweden, but President Adams also asked his son to write him frequently about affairs in Europe. In 1799, Adams negotiated a new trade agreement between the United States and Prussia, though he was never able to complete an agreement with Sweden.