US President Barack Obama has paid a solemn visit to the Robben Island prison cell where Nelson Mandela was jailed for 18 years by South Africa's racist apartheid regime.

On Sunday 30 June, America's first black president took his wife and two children to see where South Africa's first black president spent so much of his life incarcerated.

Obama's visit to the country has been overshadowed by the ailing health of Mandela, who is battling for his life in a hospital in Pretoria.

In a scribbled note in the Robben Island guestbook, Obama said he was humbled by the experience.

He wrote: "On behalf of our family, we're deeply humbled to stand where men of such courage faced down injustice and refused to yield.

"The world is grateful for the heroes of Robben Island, who remind us that no shackles or cells can match the strength of the human spirit."

Obama was accompanied by his children Natasha and Malia Ann on his visit to Robben Island, which he said had become a symbol of freedom around the world.

Speaking ahead of the visit, Obama told South Africans, "For me to be able to bring my children and teach them the history of that place and help them understand how those lessons apply to their own lives and to the future citizens of the world is a great privilege and honour."

Today's visit was the second time Obama has visited Robben Island to see Mandela's old cell. He first visited in 2006, as a senator.

Mandela's health problems have been partly blamed on the hard labour sentence he served on Robben Island.