The United States acquired most of the area of North Dakota from France in 1803 as part of the Louisiana Purchase. It obtained the area in the north and northeast part of the present-day state by a convention, signed with Great Britain in 1818 that extended the northern boundary along the 49th parallel. Dakota Territory was organized on March 2, 1861, from unorganized area formerly within Minnesota Territory and part of Nebraska Territory. Dakota Territory included all of the present-day states of North Dakota and South Dakota, most of Montana, the northern half of Wyoming, and a small part of Nebraska. The territory was reduced in 1863 with the organization of Idaho Territory, enlarged in 1864 with the addition of most of the remainder of present-day Wyoming, and again reduced with the organization of Wyoming Territory in 1868. In 1882, the state of Nebraska acquired an area north of the Keya Paha River and Niobrara River. North Dakota was admitted to the Union simultaneously with South Dakota on November 2, 1889, as the 39th and 40th states, with generally the same boundaries as the present states.