nelson mandela was famous for being the leader of a violent marxist revolutionary front (African National Congress and their militant wing Spear of the Nation) who were not removed from the US terrorist watchlist until 2008, and frequently engaged other non-marxist anti-apartheid groups on violent clashes. The ANC's tralateral union with the south african communist party and the concgress of african trade unions resulted in mandela being arested for communist agitation, not opposing apartheid.
he was held as communist, for his communist and socialist agitation for decades before finally being released.
in south africa being a socialist or communist agitator was a crime, a crime of which he was guilty. while being a commie or socialist should not be a crime in my opinion, and that he was never properly charged or convicted of that crime, doesnt change the fact that he was a socialist and communist agitator and thus was, under south african law, a criminal who should have been imprisoned for his crimes. this may not be just, but it is legal. Nelson Mandela was legally imprisoned under the laws of his nation. the same nation for which he was elected president some years later.
the ANC was not opposed to racsim, they were opposed to apartheid. Mahatma Gandhi was himself subjected to racist attacks by ANC goons when he was part of a railway building concern in south africa around 1910. the ANC has a long history of being an "africa for africans" pan-africanist party, and happily lay their own brand of racism against any who are not native africans, particularly south asians and europeans.
welcome to reality. it's rough out here. bring a hanky.