The Civil War began in 1861 due to longstanding differences between the Northern and Southern states over issues like states' rights, slavery, and economics. Abraham Lincoln was elected president in 1860, and several Southern states seceded to form the Confederate States of America. When Confederate forces attacked Fort Sumter in South Carolina in 1861, the Civil War began. While the South had some advantages in leadership and tactics, the North had a stronger economy, more population and resources, and ultimately prevailed. Key battles like Gettysburg, Vicksburg, and Atlanta turned the tide in favor of the Union, and the war ended in April 1865 with Confederate General Robert E. Lee's surrender to Union General Ulysses S. Grant at Appomattox Court