From Lexington, Maj. Gen. David Hunter advanced against the Confederate rail and canal depots and the hospital complex at Lynchburg. Reaching the outskirts of town on June 17, his first tentative attacks were thwarted by the timely arrival by rail of Lt. Gen. Jubal A. Early's II Corps vanguard from Charlottesville. Hunter withdrew the next day after sporadic fighting because of a critical shortage of supplies. His line of retreat through West Virginia took his army out of the war for nearly a month and opened the Shenandoah Valley for a Confederate advance into Maryland.