General Robert E. Lee, entrenched at Petersburg, wanted to siphon off some of the overwhelming number of Federal troops that he faced. He was also concerned with recent Union victories in the Shenandoah Valley. He devised a daring plan to accomplish both ends. On June 12, 1864, Lee ordered Jubal Early to take independent command of the Army of Northern Virginia's Second Corps, renaming it as the Army of the Valley. Early was to march north through the Shenandoah Valley, cross the Potomac River into Maryland, and possibly threaten either Baltimore or Washington. Early immediately made preparations for independent action. Departing Petersburg via train, the army arrived in the valley at the rail center of Lynchburg to reinforce John C. Breckinridge and to contest the Federals in the region. However, David Hunter withdrew his Union troops in the face of Early's larger force. Readily brushing aside the remaining small Federal garrisons in a series of minor engagements, Early proceeded northward and then east from the valley across the South Mountain range. Near Frederick, Maryland, the force was delayed by a full day at the Battle of Monocacy by Lew Wallace. On July 11, Early threatened Washington before withdrawing two days later. On July 24, after returning to the Shenandoah, the Army of the Valley won its last major battle, Second Kernstown, defeating George Crook's VIII Corps. Early dispatched much of his cavalry under John McCausland to raid and subsequently burn much of Chambersburg, Pennsylvania. By the end of July, fed up with Early's free rein of the valley, President Abraham Lincoln met with Ulysses S. Grant to discuss options. Maj. Gen. Philip Sheridan was assigned to command, replacing the defeated Hunter, who promptly resigned. In a series of sharp engagements in August through October, Sheridan repeatedly defeated the Army of the Valley and drove Early's men southward. The Army of the Valley was no longer a significant threat. Early's battered force stayed together throughout the winter of 1864-65, but was a shadow of its former size and potency. Many men deserted and returned home. The remainder were low on supplies, ammunition, clothing, and food, yet maintained a military presence. However, on February 27, 1865, Sheridan departed Winchester with two cavalry divisions and moved into position to attack Early near Waynesboro with the division commanded by Major General George Armstrong Custer. After a brief stand-off, a determined Federal attack rolled up Early's exposed right flank and scattered his small force. General Early and a few other officers and troops were able to avoid capture, but over 1,500 men were captured and sent to Fort Delaware to await the end of the war. The Army of the Valley ceased to exist and Lee dismissed Early from the service, fearing that he could not instill enough confidence in the new recruits required to keep the fighting going.