The war effectively ended on April 9, 1865, when Confederate General Lee surrendered to Union General Grant at Appomattox Court House, after abandoning Petersburg. Confederate generals throughout the Southern states followed suit, the last surrender on land occurring on June 23. At the end of the war, much of the South's infrastructure was destroyed, especially its railroads. The Confederacy collapsed, slavery was abolished, and four million enslaved black people were freed. The war-torn nation then entered the Reconstruction era in a partially successful attempt to rebuild the country and grant civil rights to freed slaves.