Throughout the war, the Confederacy sent armies out of Virginia through the Shenandoah Valley to invade Maryland and Pennsylvania and threaten Washington, D.C. Lt. Gen. Jubal Early, following the same pattern in the Valley Campaigns of 1864, and hoping to distract Grant from the Siege of Petersburg, attacked Union forces near Washington and raided several towns in Pennsylvania. Grant, reacting to the political commotion caused by the invasion, organized the Middle Military Division, whose field troops were known as the Army of the Shenandoah. He considered various candidates for command, including George Meade, William B. Franklin, and David Hunter, with the latter two intended for the military division while Sheridan would command the army. All of these choices were rejected by either Grant or the War Department and, over the objection of Secretary of War Edwin Stanton, who believed him to be too young for such a high post, Sheridan took command in both roles at Harpers Ferry on August 7, 1864. His mission was not only to defeat Early's army and to close off the Northern invasion route, but to deny the Shenandoah Valley as a productive agricultural region to the Confederacy. Grant told Sheridan, "The people should be informed that so long as an army can subsist among them recurrences of these raids must be expected, and we are determined to stop them at all hazards. ... Give the enemy no rest ... Do all the damage to railroads and crops you can. Carry off stock of all descriptions, and negroes, so as to prevent further planting. If the war is to last another year, we want the Shenandoah Valley to remain a barren waste."