After the Battle of Seven Pines, which concluded on June 1, 1862, the Union Army of the Potomac, commanded by Maj. Gen. George B. McClellan, sat passively at the outskirts of the Confederate capital of Richmond. The newly appointed commander of the Confederate Army of Northern Virginia, General Robert E. Lee, devoted most of the month to reorganizing his army and preparing an offensive intended to drive the Union invaders away from the capital. He also sent for reinforcements— Stonewall Jackson arrived on June 25 with four divisions (his own, now commanded by Brig. Gen. Charles S. Winder, and those of Maj. Gen. Richard S. Ewell, Brig. Gen. William H. C. Whiting, and Maj. Gen. D.H. Hill) from the Shenandoah Valley following his successful Valley Campaign.
The Union Army straddled the rain-swollen Chickahominy River. The bulk of the army, four corps, was arrayed in a semicircular line south of the river. The remainder, the V Corps under Brig. Gen. Fitz John Porter, was north of the river near Mechanicsville in an L-shaped line facing north-south behind Beaver Dam Creek and southeast along the Chickahominy. Lee's plan was to cross the Chickahominy with the bulk of his army to attack the Union north flank, leaving only two divisions (under Maj. Gens. Benjamin Huger and John B. Magruder) to hold a line of entrenchments against McClellan's superior strength. This would concentrate about 65,500 troops to oppose 30,000, leaving only 25,000 to protect Richmond and to contain the other 60,000 men of the Union Army. It was a risky plan that required careful execution, but Lee knew that he could not win in a battle of attrition or siege against the Union Army. The Confederate cavalry under Brig. Gen. J.E.B. Stuart had reconnoitered Porter's right flank (as part of a daring, although militarily pointless, circumnavigation of the entire Union Army from June 12 to June 15) and found it vulnerable. McClellan was aware of Jackson's arrival and presence at Ashland Station, but did nothing to reinforce Porter's vulnerable corps north of the river.
Lee's plan called for Jackson to begin the attack on Porter's north flank early on June 26. Maj. Gen. A.P. Hill's Light Division was to advance from Meadow Bridge when he heard Jackson's guns, clear the Union pickets from Mechanicsville, and then move to Beaver Dam Creek. Maj. Gens. D.H. Hill and James Longstreet were to pass through Mechanicsville, D.H. Hill to support Jackson and Longstreet to support A.P. Hill. Lee did not anticipate that the Union entrenchments behind the creek would have to be assaulted, expecting that Jackson's flanking movement would force Porter to abandon his line. South of the river, Magruder and Huger were to demonstrate to deceive the four Union corps on their front.
Lee's intricate plan went awry immediately. Jackson's men, fatigued from their recent campaign and lengthy march, ran at least four hours behind schedule. By 3 p.m., A.P. Hill grew impatient and began his attack without orders, a frontal assault with 11,000 men. The Union division of Brig. Gen. George A. McCall was forced back. Porter reinforced McCall with the brigades of Brig. Gens. John H. Martindale and Charles Griffin and extended and strengthened his right flank. He fell back and concentrated along Beaver Dam Creek and Ellerson's Mill. There, 14,000 well entrenched soldiers, aided by 32 guns in six batteries, repulsed repeated Confederate attacks with substantial casualties.
Jackson and his command arrived late in the afternoon, but, unable to find A.P. Hill or D.H. Hill, did nothing. Although a major battle was raging within earshot, he ordered his troops to bivouac for the evening. Although Jackson did not attack, his position near Porter's flank caused McClellan to order Porter to withdraw after dark behind Boatswain's Swamp, 5 miles to the east. McClellan was concerned that the Confederate buildup on his right flank threatened his supply line, the Richmond and York River Railroad north of the Chickahominy, and he decided to shift his base of supply to the James River. He also believed that the diversions by Huger and Magruder south of the river meant that he was seriously outnumbered. This was a strategic decision of grave import because it meant that, without the railroad to supply his army, he would be forced to abandon his siege of Richmond.
A.P. Hill, now with Longstreet and D.H. Hill behind him, continued his attack, despite orders from Lee to hold his ground. His assault was beaten back with heavy casualties
Overall, the battle was a Union tactical victory, in which the Confederates suffered heavy casualties and achieved none of their specific objectives due to the seriously flawed execution of Lee's plan. Instead of over 60,000 men crushing the enemy's flank, only five brigades, about 15,000 men, had seen action. Their losses were 1,484 versus Porter's 361. Lee's staff recalled that he was "deeply, bitterly disappointed" by Jackson's performance, but communication breakdowns, poorly written orders from Lee, and bad judgment across most of Lee's subordinates were to blame.
Despite the short-term Union success, however, it was the start of a strategic debacle and the unraveling of the Peninsula Campaign. McClellan began to withdraw his army to the southeast and never regained the initiative. The next day the Seven Days Battles continued as Lee again assaulted Porter in the Battle of Gaines' Mill.