Robert E Lee resigned his commission from the United State Army on April 20th 1861. Three days after the state of Virginia adopted secession. In a letter he wrote to his sister he wrote, "We are now in a state of war which will yield to nothing. The whole south is in a state of revolution, into which Virginia, after a long struggle, has been drawn; and though I recognize no necessity for this state of things, and would have forborne and pleaded to the end for redress of grievances, real or supposed, yet in my own person I had to meet the question whether I should take part against my native state. With all my devotion to the Union, and the feeling of loyalty and duty of an American citizen, I have not been able to make up my mind to raise my hand against my relatives, my children, my home. I have therefore resigned my commission m the army, and, save in defense of my native state--with the sincere hope that my poor services may never be needed--I hope I may never be called upon to draw my sword."
Some good books on this subject
Robert E. Lee on Leadership : Executive Lessons in Character, Courage, and Vision