On July 29, Pope moved some of his forces to a position near Cedar Mountain, from whence he could launch raids on Gordonsville. Jackson advanced to Culpeper on August 7, hoping to attack one of Pope's corps before the rest of the army could be concentrated. On August 9, Nathaniel Banks's corps attacked Jackson at Cedar Mountain, gaining an early advantage. A Confederate counterattack led by A.P. Hill drove Banks back across Cedar Creek. By now Jackson had learned that Pope's corps were all together, foiling his plan of defeating each in separate actions. He remained in position until August 12, when he withdrew to Gordonsville.