Ironically he was less of a racist than Lincoln, who did not believe blacks should inter marry, hold public office or have the vote. Lee was a patriot and great general. The CSA had just as much right to leave the Union as the 13 states had to leave the crown.
So far from engaging in a war to perpetuate slavery, I am rejoiced that slavery is abolished. I believe it will be greatly for the interests of the south. So fully am I satisfied of this, as regards Virginia especially, that I would cheerfully have lost all I have lost by the war, and have suffered all I have suffered, to have this object attained.
Robert E. Lee