His transformation reflects the changing moods in the US around race, mythology and national reconciliation.

Confederate Army Gen. Robert E. Lee was vilified during the Civil War only to become a heroic symbol of the South's "Lost Cause" — and eventually a racist icon.

His transformation, at the center of the recent violence in Charlottesville, Virginia, reflects the changing moods in the United States around race, mythology and national reconciliation, historians say.

Lee monuments, memorials and schools in his name erected at the turn of the 20th Century are now facing scrutiny amid a demographically changing nation.

But who was Robert E. Lee beyond the myth? Why are there memorials in his honor in the first place?

THE SOLDIER

A son of American Revolutionary War hero Henry "Light-Horse Harry" Lee, Robert E. Lee graduated second in his class at West Point and distinguished himself in various battles during the U.S.-Mexico War. As tensions heated around southern secession, Lee's former mentor, Gen. Winfield Scott, offered him a post to lead the Union's forces against the South. Lee declined, citing his reservations about fighting against his home state of Virginia.

Lee accepted a leadership role in the Confederate forces although he had little experience leading troops. He struggled but eventually became a general in the Confederate Army, winning battles largely because of incompetent Union Gen. George McClellan. He would win other important battles against other Union's generals, but he was often stalled. He was famously defeated at Gettysburg by Union Maj. Gen. George Meade. Historians say Lee's massed infantry assault across a wide plain was a gross miscalculation in the era of artillery and rifle fire.

A few weeks after becoming the general in chief of the armies of the Confederate states, Lee surrendered to Union Gen. Ulysses S. Grant at Appomattox Court House in Virginia on April 9, 1865.

Virginia State Troopers stand under a statue of Robert E. Lee before a white supremacists rally in Charlottesville, Virginia, U.S., August 12, 2017.REUTERS/Joshua Roberts

THE SLAVE OWNER

A career army officer, Lee didn't have much wealth, but he inherited a few slaves from his mother. Still, Lee married into one of the wealthiest slave-holding families in Virginia — the Custis family of Arlington and descendants of Martha Washington. When Lee's father-in-law died, he took leave from the U.S. Army to run the struggling estate and met resistance from slaves expecting to be freed.

Documents show Lee was a cruel figure with his slaves and encouraged his overseers to severely beat slaves captured after trying to escape. One slave said Lee was one of the meanest men she had ever met.

In a 1856 letter, Lee wrote that slavery is "a moral & political evil." But Lee also wrote in the same letter that God would be the one responsible for emancipation and blacks were better off in the U.S. than Africa.

THE LOST CAUSE ICON

After the Civil War, Lee resisted efforts to build Confederate monuments in his honor and instead wanted the nation to move on from the Civil War.

After his death, Southerners adopted "The Lost Cause" revisionist narrative about the Civil War and placed Lee as its central figure. The Lost Cause argued the South knew it was fighting a losing war and decided to fight it anyway on principle. It also tried to argue that the war was not about slavery but high constitutional ideals.

As The Lost Cause narrative grew in popularity, proponents pushed to memorialize Lee, ignoring his deficiencies as a general and his role as a slave owner. Lee monuments went up in the 1920s just as the Ku Klux Klan was experiencing a resurgence and new Jim Crow segregation laws were adopted.

The Robert E. Lee statue in Charlottesville, Virginia, went up in 1924. A year later, the U.S. Congress voted to use federal funds to restore the Lee mansion in the Arlington National Cemetery.

The U.S. Mint issued a coin in his honor, and Lee has been on five postage stamps. No other Union figure besides President Abraham Lincoln has similar honors.

Confederate General Robert E Lee (1807 - 1870) surrending to the Union General Ulysses S Grant (1822 - 1885) at the Appomattox court house in VirginiaHulton Archive/Getty Images

A NEW MEMORY

A generation after the civil rights movement, black and Latino residents began pressuring elected officials to dismantle Lee and other Confederate memorials in places like New Orleans, Houston and South Carolina. The removals partly were based on violent acts committed white supremacists using Confederate imagery and historians questioning the legitimacy of The Lost Cause.

A Gen. Robert E. Lee statue was removed from Lee Circle in New Orleans as the last of four monuments to Confederate-era figures to be removed under a 2015 City Council vote.

The Houston Independent School District also voted in 2016 to rename Robert E. Lee High School, a school with a large Latino population, as Margaret Long Wisdom High School.

Earlier this year, the Charlottesville, Virginia, City Council voted to remove its Lee statue from a city park, sparking a lawsuit from opponents of the move. The debate also drew opposition from white supremacists and neo-Nazis who revered Lee and the Confederacy. The opposition resulted in rallies to defend Lee statues this weekend that resulted in at least three deaths.