Mr. Mandela spent 27 years in prison for his work with the ANC to fight apartheid rule in South Africa .