During the Civil War, the Manassas Gap Railroad and the Orange and Alexandria Railroad intersected at Manassas Junction, making it strategically important to both the Union and the Confederacy as a supply depot and transportation center. The Orange and Alexandria also connected with the Virginia Central Railroad at Gordonsville, creating the only complete railroad link between Washington and Richmond, so control of the line meant control of transportation and communication between the two capitals. The Manassas Gap Railroad provided access to the produce and livestock of the Shenandoah Valley, helped protect the valley's northern end from Union attack, and enabled Confederate troop movements against Harpers Ferry and the Baltimore and Ohio Railroad. On May 6, 1861, Robert E. Lee, planning Virginia's defense against invasion, ordered Philip St. George Cocke to post a force at Manassas Gap Junction strong enough to defend it from troops from Washington. Confederate forces guarding the junction soon fought the first of two major battles nearby. A year later, just before the Second Battle of Manassas, Thomas J. "Stonewall" Jackson raided the large Federal supply depot there, destroying support buildings and camps and leaving behind burned structures, wrecked rail equipment, and other stark ruins that reflected the war's damage to civilians and the thousands of soldiers who passed through the junction.