This 1863 map of the newly-formed West Virginia did not include Berkeley and Jefferson Counties.
The two counties on the tip of the Eastern Panhandle and along the Potomac River were frequent sites of conflict during the Civil War. Some Jefferson County towns changed hands between the Union and Confederacy over a dozen times. The Baltimore and Ohio Railroad ran through Martinsburg in Berkeley County and was critical to both sides.
Residents of both counties were loyal to the South but they were under Union control most of the war including in 1863 when the counties voted to become part of West Virginia. The occupying troops are believed to have ensured the outcome.
But voters who were away fighting for the Confederacy when the vote was taken were outraged when they returned at the end of the war and demanded to rejoin the Old Dominion. In 1866 the Virginia General Assembly brought suit to reclaim the counties.
In a 6 to 3 ruling in 1871, the United State Supreme Court affirmed that Berkeley and Jefferson Counties had obtained the consent of both Virginia and the U.S. Congress to join the new state and the two counties were officially part of West Virginia.