Lee entered West Point in 1825. When he graduated (second in his class of forty six) in 1829 he had not only attained the top academic record but was the first cadet to graduate the Academy without a single demerit. He was commissioned as second lieutenant in the engineers.
Lee served for seventeen months at Fort Pulaski on Cockspur Island, Georgia. In 1831, he was transferred to Fort Monroe, Virginia, as assistant engineer. While he was stationed there, he married Mary Anna Randolph Custis, the great-granddaughter of Martha Washington. They settled in the Custis mansion, located on the banks of the Potomac River in Arlington, just across from Washington, D.C.. They eventually had three sons and four daughters.
Lee served as an assistant in the chief engineer's office in Washington from 1834 to 1837, but spent the summer of 1835 helping to lay out the state line between Ohio and Michigan. In 1837, he got his first important command. As a first lieutenant of engineers, he supervised the engineering work for St. Louis harbour and for the upper Mississippi and Missouri rivers. His work there earned him a promotion to captain. In 1841, he was transferred to Fort Hamilton in New York harbour, where he took charge of building fortifications.
Lee distinguished himself in the Mexican War 1846-48. Initially he was sent as a supervisor of road construction but his skills as a cavalryman soon lead to a more direct involvement in the fighting.
He was promoted to Major after distinguishing himself in the battle of Cerro Gordo, in April, 1847. He also fought at Contreras, Cherubusco and Chapultepec, and was wounded at the later. By the end of the war he had been promoted to Lieutenant-Colonel.
After the Mexican War, he spent three years at Fort Carrol in Baltimore harbor then became the superintendent of West Point in 1852. During his three years at West Point, he improved the buildings, the courses, and spent a lot of time with the cadets.
These were not happy years for Lee as he did not like to be away from his family for long periods of time, especially as his wife was becoming increasingly ill. Lee came home to see her as often as he could.
He happened to be in Washington at the time of John Brown's raid on Harpers Ferry, Virginia (now West Virginia) in 1859, and was sent there to arrest Brown and to restore order. He did this very quickly and then returned to his regiment in Texas. When Texas seceded from the Union in 1861, Lee was called to Washington D.C. to wait for further orders.
On April 18, 1861, on the eve of the Civil War, President Abraham Lincoln, through Secretary Francis Blair, offered him command of the Union Army. There was little doubt as to Lee's sentiments. He was opposed to secession and considered slavery evil. He had freed his own inherited slaves long before the war began. However his loyalty to his native Virginia led him to join the Confederacy. At the outbreak of war he became military adviser to Jefferson Davis, president of the Confederacy, whom he knew from West Point.
On June 1, 1862 he received the command of the Army of Northern Virginia and later that year won the Seven Days' Battle defending Richmond, Virginia, the Confederate capital, against General McClellan's Union forces. In 1863 Lee won victories at Fredericksburg and Chancellorsville, both in Virginia, and in 1864 at Cold Harbor, Virginia, but was besieged in Petersburg, Virginia, June 1864-April 1865. He surrendered to General Ulysses S. Grant on April 9, 1865, at Appomattox Courthouse.
Following the war Lee applied for but was never granted the official postwar amnesty.
His wife's family home where they lived before the Civil War had been seized by Union forces and now is part of Arlington National Cemetery.
In 1975 Lee's citizenship was restored posthumously by an act of the U.S. Congress.