On May 26, General Grant concluded that Lee's defenses on the North Anna River could not be attacked directly without unjustifiable slaughter and could not be turned on either flank because of swamps and multiple streams, so he withdrew the Union army across the North Anna and began another movement around the Confederate right. The two armies collided again in a deadlock on May 29 at Totopotomoy Creek, even nearer Richmond, while Lee's army followed closely in search of an opportunity to drive back the Union Army. Although reluctant to leave the North Anna, Grant grew more confident, believing that the Confederate failure to strike the Army of the Potomac at its most vulnerable showed that after three weeks of fighting the Army of Northern Virginia was beaten and that success was assured. That confidence proved disastrous on June 3, when he attacked Lee's defenses at Cold Harbor and suffered a bloody repulse. The contest between Grant and Lee continued for another eleven months until the Confederate surrender at Appomattox Court House.