Jefferson Davis appointed Robert E. Lee commander of the Army of Northern Virginia in June 1862 after General Joseph E. Johnston was injured during fighting in the Peninsular Campaign. Lee attacked McClellan’s army three weeks later and in savage fighting during the Seven Days’ Campaign forced the Union army out of the Peninsula. That saved Richmond for the time being. As the war wore on Lee realized he needed to change his strategy. Rather than keep fighting McClellan in Virginia he decided to bring the fighting closer to Washington, so he shifted his campaign to Maryland.