At first, Lee did not command any soldiers in battle. Instead, he helped Confederate president Jefferson Davis make military decisions. In 1862, he became the commander of the Army of Northern Virginia. He would lead the army for the rest of the war. He would win many battles, even though the Union army in the battles had more men and weapons. At the Battle of Gettysburg, he tried to invade the Union in order to end the war. But his army was defeated and he had to retreat back into Virginia.