In April 1861, Virgina brought together its delegates to vote on whether the state should secede from the Union. Of the 31 delegates from western Virgina, only 5 voted to secede. However, the majority of the remaining delegates statewide voted for secession, and Virginia separated from the United States, joining the Confederacy.
Unionist meetings were held throughout the western region, working toward an ultimate goal of setting up a capitol in Wheeling. Then, just as Virginia had seceded form the Union, they would secede from Virginia.
The US Constitution allows a portion of any state to secede into a separate state only with the existing state's legislature's blessing. The new territory, which was dubbed "Kanawha", was able to circumvent this rule by declaring that the Virginia state government was illegal, since secession from the Union itself was not legal under the US Constitution.
In July 1861, the United States accepted Kanawha into the Union. The statehood referendum passed in October 1861, despite protests by pro-confederate residents. The Union Army quickly established a presence within the new state. On June 20, 1863 full statehood was granted, though under the name of "West Virginia" not Kanawha -- with the stipulation that all slaves must be emancipated.