Mandela spent a total of 27 years in prison for his anti-apartheid activities before his release in 1990. He became the first elected President of South Africa on May 10, 1994, following the end of apartheid and the country's first multi-racial democratic election.