PRETORIA, South Africa (AP) ? President Barack Obama on Saturday encouraged leaders in Africa and around the world to follow former South African President Nelson Mandela's example of country before self, as the U.S. president prepared to pay personal respects to relatives who have been gathered around the critically ill anti-apartheid icon.
"We as leaders occupy these spaces temporarily and we don't get so deluded that we think the fate of our country doesn't depend on how long we stay in office," Obama said.
Obama spoke at a news conference with South African President Jacob Zuma in the midst of a weeklong tour of the continent that also included stops in Senegal and Tanzania. But many other African nations are embroiled in religious, sectarian and other conflicts.
Obama decided to avoid stopping in his father's home nation of Kenya because of international disputes there. The International Criminal Court is prosecuting Kenyan President Uhuru Kenyatta for crimes against humanity, including murder, deportation, rape, persecution and inhumane acts allegedly committed by his supporters in the violent aftermath of Kenya's 2007 elections.
"The timing was not right for me as the president of the United States to be visiting Kenya when those issues are still being worked on, and hopefully at some point resolved," Obama said. He noted he's visited Kenya several times previously and expects he will as well in the future.
Obama and Zuma appeared at the Union Buildings that house government offices and the site of Mandela's 1994 inauguration as the country's first black president after 27 years behind bars for his activism.
The 94-year-old Mandela has been in a nearby hospital for three weeks after being admitted with a lung infection. Zuma told reporters that Mandela is in critical but stable condition and the whole nation is praying that he will improve.
Obama and his wife planned to meet with some of Mandela's relatives later in the day but because of their wishes doesn't plan to see the man Obama on Saturday revered as "one of the greatest people in history."
Obama referred to Mandela by his clan name as he praised South Africa's historic integration from white racist rule as a shining beacon for the world.
"The struggle here against apartheid for freedom, Madiba's moral courage, this country's historic transition to a free and democratic nation has been a personal inspiration to me, it has been an inspiration to the world," Obama said.
"The outpouring of love that we've seen in recent days shows that the triumph of Nelson Mandela and this nation speaks to something very deep in the human spirit, the yearning for justice and dignity that transcends boundaries of race and class and faith and country," Obama said. "That's what Nelson Mandela represents, that's what South African at its best represents to the world, and that's what brings me back here."
Zuma told Obama he and Mandela are "bound by history as the first black presidents of your respective countries."
"Thus, you both carry the dreams of millions of people in Africa and in the diaspora who were previously oppressed," Zuma said, reading from a prepared statement.
On other topics, Obama declined to commit to supporting South Africa's bid for a permanent seat on the United Nations Security Council. He said the U.N.'s structure needs to be updated and it would be "odd" for an expanded Security Council not to have African representation.
"How we do that and what fashion is complicated, it's difficult and it involves all kinds of politics," Obama said.
"Everybody wants a seat at the table, but when it comes time to step up and show responsibility, sometimes people want to be free riders," Obama said, adding he wasn't referring to South Africa specifically.
Zuma responded that he wishes the process of change at the U.N. would speed up.
Obama also said he wants to boost trade with Africa and plans to renegotiate an African trade pact to improve it for American businesses. He said he welcomes competition from other nations who have been aggressive in pursuing commercial opportunities in Africa, including China.
"I don't feel threatened by it. I think it's a good thing," he said. He added: "Our only advice is make sure it's a good deal for Africa." He said that includes making sure foreign investment employs Africans and doesn't tolerate corruption or take its natural resources without compensation for Africans.
Obama also is paying tribute to South Africa's fight against apartheid by visiting the Soweto area Saturday afternoon for a town hall with students at the University of Johannesburg. At least 176 young people were killed in Soweto township 27 years ago this month during a youth protest against the apartheid regime's ban against teaching local Bantu languages. The Soweto Uprising catalyzed international support against apartheid, and June is now recognized as Youth Month in South Africa.
The university plans to bestow an honorary law degree on the U.S. president.
Protesters demonstrated outside the university against U.S. policy on issues including the U.S. detention center at Guantanamo Bay, Cuba, the war in Afghanistan and global warming. Hundreds marched to the U.S. Embassy on Friday, carrying signs that read: "No, You Can't Obama," a message inspired by Obama's "yes, we can" campaign slogan.
Obama has been trying to inspire the continent's youth to become civically active and part of a new democratically minded generation. Obama hosted young leaders from more than 40 African countries at the White House in 2010 and challenged them to bring change to their countries by standing up for freedom, openness and peaceful disagreement.
Obama wraps up his South Africa stay Sunday, when he plans to give a sweeping speech on U.S.-Africa policy at the University of Cape Town and take his family to Robben Island to tour the prison where Mandela spent 18 of his 27 years behind bars.
Obama has visited the island before, but said it's a particular privilege to bring his daughters back to learn its lessons.
Follow Nedra Pickler on Twitter at https://twitter.com/nedrapickler