The Gettysburg campaign was a military invasion of Pennsylvania by the main Confederate army under General Robert E. Lee in summer 1863. It was the first time during the war the Confederate Army attempted a full scale invasion of a free state. The Union won a decisive victory at Gettysburg, July 1–3, with heavy casualties on both sides. Lee managed to escape back to Virginia with most of his army. It was a turning point in the American Civil War, with Lee increasingly pushed back toward Richmond until his surrender in April 1865. The Union Army of the Potomac was commanded by Maj. Gen. Joseph Hooker and then (from June 28) by Maj. Gen. George G. Meade. After his victory in the Battle of Chancellorsville, Lee's Army of Northern Virginia moved north for a massive raid designed to obtain desperately needed supplies, to undermine civilian morale in the North, and to encourage anti-war elements. Lee's army slipped away from Federal contact at Fredericksburg, Virginia, on June 3, 1863. The largest predominantly cavalry battle of the war was fought at Brandy Station on June 9. The Confederates crossed the Blue Ridge Mountains and moved north through the Shenandoah Valley, capturing the Union garrison at Winchester, in the Second Battle of Winchester, June 13–15. Crossing the Potomac River, Lee's Second Corps advanced through Maryland and Pennsylvania, reaching the Susquehanna River and threatening the state capital of Harrisburg. However, the Army of the Potomac was in pursuit and had reached Frederick, Maryland, before Lee realized his opponent had crossed the Potomac. Lee moved swiftly to concentrate his army around the crossroads town of Gettysburg. The Battle of Gettysburg was the deadliest of the war. Starting as a chance meeting engagement on July 1, the Confederates were initially successful in driving Union cavalry and two infantry corps from their defensive positions, through the town, and onto Cemetery Hill. On July 2, with most of both armies now present, Lee launched fierce assaults on both flanks of the Union defensive line, which were repulsed with heavy losses on both sides. On July 3, Lee focused his attention on the Union center. The defeat of his massive infantry assault, Pickett's Charge, caused Lee to order a retreat that began the evening of July 4. The Confederate retreat to Virginia was plagued by bad weather, difficult roads, and numerous skirmishes with Union cavalry. However, Meade's army did