The Adams–Onís Treaty of 1819, between the Kingdom of Spain and the United States, established the southern and western boundaries of the old Louisiana Purchase territory of 1803, with the Royal Spanish territories of Spanish Texas and Santa Fe de Nuevo México.
As a result of the protracted negotiations, the United States surrendered a significant portion of the Missouri Territory claimed in the southwest to Spain in exchange for the peninsula of Spanish Florida further east.
[2] The remaining portion of the territory to the north, northwest, west and southwest, consisting of the present states of Iowa, Nebraska, and the Dakotas, most of Kansas, Wyoming, Montana, and parts of Colorado, Minnesota and New Mexico, effectively became reverted to the status of unorganized territory after 1821, when Missouri became the 21st state.
Thirteen years later in 1834, the portion in the north and east of the upper Missouri River was attached to the Michigan Territory around the Great Lakes.
Over time, various federal territories in the West were created in whole or in part from its remaining area of unorganized status, as follows: Indian Territory (1834), added with future Oklahoma (1890), Iowa (1838), Minnesota (1849), Kansas and Nebraska (both 1854), Colorado and Dakota (both 1861), Idaho (1863), Montana (1864), and Wyoming (1868).