From April 6 to 10, 1865, Lynchburg served as the capital of Virginia after the Confederate government fled from Richmond. Governor William Smith and the Commonwealth's executive and legislative branches escaped to Lynchburg as Richmond surrendered on April 3. Gen. Robert E. Lee surrendered to Gen. Ulysses S. Grant at Appomattox Courthouse, roughly east of Lynchburg, ending the Civil War. Lynchburg surrendered on April 12, to Union General Ranald S. Mackenzie.