Jackson performed exceptionally well in the campaigns in the Shenandoah Valley in 1862. Despite an initial defeat due largely to faulty intelligence, through swift and careful maneuvers Jackson was able to defeat three separate Union armies and prevent any of them from reinforcing General George B. McClellan's Army of the Potomac in its campaign against Richmond. Jackson then quickly moved his three divisions to reinforce General Lee's Army of Northern Virginia in defense of Richmond. He performed poorly in the Seven Days Battles against George B. McClellan's Army of the Potomac, as he was frequently late arriving on the field. During the Northern Virginia Campaign that summer, Jackson's troops captured and destroyed an important supply depot for General John Pope's Army of Virginia, and then withstood repeated assaults from Pope's troops at the Second Battle of Bull Run. Jackson's troops played a prominent role in September's Maryland Campaign, capturing the town of Harpers Ferry, a strategic location, and providing a defense of the Confederate Army's left at Antietam. At Fredericksburg in December, Jackson's corps buckled but ultimately beat back an assault by the Union Army under Major General Ambrose Burnside. In late April and early May 1863, faced with a larger Union army now commanded by Joseph Hooker at Chancellorsville, Lee divided his force three ways. On May 2, Jackson took his 30,000 troops and launched a surprise attack against the Union right flank, driving the opposing troops back about two miles. That evening he was accidentally shot by Confederate pickets. The general lost his left arm to amputation; weakened by his wounds, he died of pneumonia eight days later.