With Union armies closing in on all sides, the outlook was not good for Lee. On March 25, 1865 he attempted to smash through Grant's army, but with half as many troops, he was defeated. On April 1, 1865, Lee made his last attack by attacking Grant's left flank. He met up with Sheridan, who had just arrived, and was repelled. He then tried to escape the ever tightening loop around him to meet up with Johnston, but the loop had closed too far.
Lee met Grant at Appomattox Courthouse on April 9, 1865 and surrendered. Grant ordered 25,000 rations to be given to the hungry Confederate army. They were paroled to return home with their horses and their officers' side arms. The long and bloody battle for Virginia had ended along with all hopes of the Confederacy.