What role did West Virginia take during the Civil War?

West Virginia was part of Virginia when that state seceded from the
Union in 1861.

The delegates of 40 western counties formed their own government and seceded from Virginia to join the Union side.

These counties entered the Union as the state of West Virginia in 1863.