Former US president Barack Obama said today's times are "strange and uncertain" in a speech to a crowd of 15,000 people in South Africa as the centrepiece of celebrations marking 100 years since Nelson Mandela's birth.
The former president said "politics of fear, resentment" are moving at a pace unimaginable a few years ago.
While not mentioning his successor, President Donald Trump, by name, Mr Obama's speech in South Africa countered many of Mr Trump's policies, rallying people to keep alive the ideas that Mandela worked for including democracy, diversity and tolerance.
He targeted politicians pushing "politics of fear, resentment, retrenchment," saying they are on the move "at a pace unimaginable just a few years ago."He attacked "strongman politics," saying that "those in power seek to undermine every institution ... that gives democracy meaning."
His words were met with cheers by a crowd of about 14,000 people gathered at a cricket stadium in Johannesburg for the speech, which was streamed online.
Mr Obama has made relatively few public appearances since leaving the White House in 2017, but he has often credited Mandela for being one of the great inspirations in his life.
Mr Obama is delivering the Nelson Mandela Annual Lecture at a cricket stadium in Johannesburg in an address which will urge young people to fight to defend democracy, human rights and peace.
Mandela, who died in 2013, remains a global icon for his long struggle against white-minority apartheid rule and for his message of peace and reconciliation after being freed following 27 years in prison.
Mr Obama met Mandela only briefly in 2005 but gave a eulogy at his funeral saying Mandela "makes me want to be a better man" and hailing him as "the last great liberator of the 20th century".
The speech comes on the eve of "Mandela Day" - his birthday, which is marked around the world every year on July 18.
The "Mandela 100" anniversary has triggered a bout of memories and tributes to the late anti-apartheid leader, as well as a debate over his legacy and South Africa's fate since he stepped down in 1999.
South African President Cyril Ramaphosa has said he would mark the day by donating half his salary to charity to honour "the great sacrifices he made and his tireless commitment to improving the lives of the most vulnerable."
But F.W. de Klerk, the former president who shared the Nobel Peace Prize with Mandela in 1993, said: "I'm convinced that President Mandela would be deeply concerned, as I am, about the present state of affairs in South Africa."
"His vision of a reconciled South Africa has become almost non-existent within the (ruling) ANC at the moment," he said.
Before arriving in South Africa, Mr Obama paid a brief visit to Kenya, his father's home country.
He opened a youth centre run by his half-sister and visited the home of his step-grandmother in the village of Kogelo, where his father was born and was buried.
Obama will also host a town hall event in Johannesburg on July 18 for 200 young leaders selected from across Africa to attend a five-day training programme.
Mandela was imprisoned under apartheid rule in 1962 and only freed in 1990 when he went on to lead the African National Congress party to victory in the first multi-race elections in 1994.
The anniversary includes a string of other events such as a walk in Johannesburg led by Mandela's widow Graca Machel, the release of letters Mandela wrote from his prison cell and the printing of a commemorative banknote.