JOHANNESBURG — South Africans along with former president Barack Obama were marking the centennial of anti-apartheid leader Nelson Mandela’s birth on Wednesday with acts of charity in a country still struggling with deep economic inequality 24 years after the end of white minority rule.
Obama met with young leaders from around Africa to mark the anniversary, a day after he delivered a spirited speech in Johannesburg about Mandela’s legacy of tolerance and criticized President Trump and his policies without mentioning him by name. An enthusiastic crowd of 14,000 gave Obama a standing ovation for his address, the highest-profile one since he left office.
‘‘Most people think of Mandela as an older man with hair like mine,’’ the 56-year-old, gray-haired Obama said to laughter from his audience on Wednesday. But he added that people forget that Mandela ‘‘started as a very young man, at your age, trying to liberate this country.’’
Speaking to participants in his Leaders Africa program, 200 young people from 44 African countries, he urged them to pursue change at home and emphasized the impact they can have as the continent’s population is the fastest-growing in the world. ‘‘How big are your ambitions?’’ he asked.
Obama also spoke out against the corruption and conflict that slow down change, mentioning as one example the current deadly tensions in Cameroon, which faces an Anglophone separatist movement and the threat from Boko Haram extremists based in neighboring Nigeria.
‘‘Find a way where you’re not selling your soul,’’ Obama said, encouraging them to engage in political work and community involvement, especially women.
South Africans and others around the world marked the July 18, 1918, birth of Mandela with clinic openings, blanket handouts, and other charitable acts. In Cape Town, numbers were painted on homes in one of the sprawling slums to help health workers locate people living with HIV and tuberculosis.
But South Africans must do more to fight for Mandela’s values daily instead of engaging in symbolic gestures on his birthday, main opposition leader Mmusi Maimane with the Democratic Alliance said, adding that South Africa’s ‘‘failed education is part of a system that locks black children out of opportunity.’’
After 27 years in prison in South Africa, Mandela was released in 1990 and became the country’s first black president four years later. He died in 2013 at the age of 95.
Events have been planned throughout the year for the 100th anniversary of his birth, including a large concert in December in South Africa that will be headlined by Beyonce and Jay-Z and hosted by Oprah Winfrey and others.
In a video message, former South African archbishop Desmond Tutu said Mandela reflected the best of humanity.
‘‘Good leaders make allowance for the fact that even they can be wrong, and they know when and how to say sorry. Madiba had this quality in abundance,’’ said Tutu, who was awarded the Nobel Peace Prize for his efforts to end apartheid and reconcile South Africans.
United Nations Secretary General Antonio Guterres in a separate statement called Mandela a towering advocate for equality and justice.
‘‘Nelson Mandela was held captive for many years. But he never became a prisoner of his past,’’ Guterres said. ‘‘Rarely has one person in history done so much to stir people’s dreams and move them to action.’’