Union forces reached the outskirts of Richmond by June 1862, but Virginian general Robert E. Lee took command of the Confederate Army of Northern Virginia, and repelled the Union army, led invasions into Union territory, and was named General in Chief of Confederate armies in February 1865. During the war, more battles were fought in Virginia than anywhere else, including the Battles of Bull Run, Fredericksburg, Chancellorsville, and the concluding Battle of Appomattox Court House, where Lee surrendered on April 9, 1865. After the capture of Richmond that month, the state capital was briefly moved to Lynchburg, while the Confederate leadership fled to Danville. 32,751 Virginians died in the Civil War. Virginia was formally restored to the United States in 1870, due to the work of the Committee of Nine.