By an Act of Congress dated 4 March 1863, Idaho Territory was established. This act was signed into law by President Abraham Lincoln . Originally, Idaho Territory included all of the present states of Idaho and Montana and all but the extreme southwestern corner of what became Wyoming. All of the Territory west of the Continental Divide came from Oregon Territory and Washington Territory, and all east of the Divide came from Dakota Territory. The first Territorial Capital was Lewiston, Idaho. Two years later, the capital was moved to Boise where it continued until statehood.
In 1864, Montana Territory was created, taken from the northeastern part of Idaho Territory east of the Bitterroot Range. The southeastern part of Idaho Territory at that time was returned to Dakota Territory.
Four years later, in 1868, Wyoming Territory was created from Dakota Territory.
Idaho was made a state on 3 July 1890.
Wikipedia page for Idaho Territory.