After their hard-fought victory at the battle of Chancellorsville, Robert E. Lee led his troops northward, through Maryland and into Pennsylvania. The battered Army of the Potomac followed. On July 1 the two armies clashed near the small town of Gettysburg. The Army of the Potomac had a new and untried commander in Gen. George G. Meade. Three days before the battle, Gen. Joe Hooker had resigned his command in a dispute with Lincoln. The early fighting favored the Rebels, who drove the bluecoats back through the town to the high ground south of it.