The portion of the Wyoming Territory east of the continental divide was acquired by the U.S. in the 1803 Louisiana Purchase and organized into the Nebraska Territory in 1854. On March 2, 1861, the northern portion of the Nebraska Territory, including the northeastern portion of future Wyoming Territory, became part of the Dakota Territory, while the southeastern portion remained with Nebraska, forming an extended Nebraska "panhandle". In 1863, the Idaho Territory was formed; it included the entirety of the modern states of Idaho and Montana and almost all of modern Wyoming save the southwest corner.