At Nelson Mandela's former prison, Barack Obama wrote how "deeply humbled" he was "to stand where men of such courage faced down injustice."
"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."
President Obama wrote his comments in the visitors' book in the prison courtyard where he saw where Mandela worked and hid his draft of his book A Long Walk to Freedom.
More top news
In the hours following the incident, journalists Can Dundar and Erdem Gul were found guilty in their trial for revealing state secrets.
After a wintry end to last week, a fast track to summer
The government has made its third U-turn in a matter of days as the prime minister struggles to push policy through on a slim majority.