Apartheid was a system of racial segregation and discrimination enforced in South Africa between 1948 and 1994. The apartheid government passed laws banning interracial marriage and sex, requiring non-whites to carry passbooks, and establishing separate residential and educational facilities for different races. The African National Congress formed to represent non-white South Africans and initially protested peacefully but turned to violence as government oppression increased. Nelson Mandela was imprisoned for 27 years for his leadership of the ANC's armed wing. International sanctions and pressure contributed to the end of apartheid and free elections in 1994, when Mandela became South Africa's first black president.