When Longstreet returned from his convalescence on October 19, 1864, Lee created the new Fourth Corps, which Anderson led through the Siege of Petersburg and the retreat towards Appomattox Court House in 1865. Because of several attacks by Federal cavalry nipping at his corps, Anderson was forced to slow and even stop from time to time and beat off the attacks. This caused the Confederates to become isolated from the rest of Lee's army moving west, and they were now the army's rear guard. The corps finally halted and fought at Sayler's Creek on April 6 which ended in a rout, and as Lee witnessed it he exclaimed "Has the army been dissolved?" As the corps' survivors reformed and rejoined the army, what was left of the Fourth Corps was merged with the Second Corps on April 8. This left Anderson without a command and he proceeded home to South Carolina. Anderson assumed command of M. H. Hannon's Cavalry Brigade after Hannon was wounded at Monroe's Crossroads. Anderson was pardoned on September 27, 1865, although there is no record of his parole.