Following the capture of Hilton Head, Beaufort, and the nearby sea islands in the fall of 1861, General Robert E. Lee was given command of the coastal military department of South Carolina, Georgia, and East Florida. From his headquarters at Coosawhatchie, about 4 miles southwest, he planned the strategy and defenses that successfully contained the enemy until the end of the war. On October 22, 1862, in running encounters near Coosawhatchie, Frampton's Plantation, and Pocotaligo, Confederate troops successfully defended the Charleston-Savannah railroad and the interior of South Carolina against a Union attack force of 4,448 men from Hilton Head.