After the 1803 Louisiana Purchase, the border between the United States and New Spain was not clearly defined. The border was established in the 1819 Adams–Onís Treaty between the United States and Spain, which specified a border in the vicinity of the western edge of the Mississippi River watershed. Mexico gained its independence from Spain, and the border was reaffirmed in the 1828 Treaty of Limits.