Protesters waved images depicting Barack Obama as Nazi leader Adolf Hitler and police fired stun grenades as ugly clashes marred the US president's visit to South Africa.

Crowds of South Africans from trade unions and pressure groups gathered at a university campus in Soweto.

Obama was in the huge Johannesburg township to deliver a speech on strengthening trade ties between the United States and South Africa.

Protesters accused Obama of being in town to plunder the country's natural resources.

They said that Johannesburg University should reverse its decision to offer him an honorary doctorate.

Scuffles broke out and police fired stun grenades to disperse the protests.

Police point weapons at protesters obscured by smoke at scene of protests at University of Johhanesburg
Police point weapons at protesters obscured by smoke at scene of protests at University of Johhanesburg

Other protests were against US foreign policy and the use of drones to strike targets, which has grown hugely during Obama's White House tenure.

Obama hailed the lasting influence Nelson Mandela has had on South Africa and the legacy of the country's first black president.

Speaking in Soweto to a small audience and on screens to millions watching around the continent, Obama was challenged on why he was not visiting Kenya, his ancestral home.

A young Kenyan woman asked the world's most powerful man if he intended to keep his word by coming to Kenya.

Obama answered, "One thing about being President is that people not only want you to fulfil your promises, they want you to do it yesterday."

He told Kenyans he stayed away from the country because, "I decided it was not the optimal time to visit."

The health of the ailing Nelson Mandela has overshadowed Obama's long-planned visit to the continent. Obama will not visit Mandela during his time in South Africa. But he vowed to take his children to Robben Island - the prison in which Mandela was incarcerated for 18 years.

Obama paid tribute to Mandela, saying "The outpouring we've seen in recent days shows the triumph of Nelson Mandela and speaks to something deep in the human spirit. This transcendence of race and class is what Nelson Mandela represents and that's what brings me back here."

Obama addresses audience in Soweto, South Africa
Obama addresses audience in Soweto, South Africa