U.S. President Barack Obama headed to South Africa on Friday for the second leg of a trip overshadowed by the deteriorating health of anti-apartheid icon Nelson Mandela.
Obama did not appear to rule out a visit to see the ailing former president, but said he will leave it up to the family.
"We'll see what the situation is when we land," he said en route to Johannesburg. "I don't need a photo op, and the last thing I want to do is to be in any way obtrusive at a time when the family is concerned with Nelson Mandela's condition."
The president left the United States on Wednesday for Senegal, South Africa and Tanzania -- his second visit to sub-Saharan Africa since taking office.
The trip aims to bolster African investment opportunities for U.S. businesses, address development issues such as food security and health, and promote democracy. It comes as China aggressively engages the continent, pouring billions of dollars into it and replacing the United States as Africa's largest trading partner.
During his last day in Dakar, Senegal, Obama attended a food security session, where he met with farmers and innovators whose technologies are bolstering the lives of regional farmers.
"I know that millet and maize and fertilizer doesn't always make for sexy copy, but ... I think if the American people knew the kind of work that is being done as a consequence of their generosity and their efforts, I think they would be very proud," he said.
The event in the Senegalese capital Friday was his last before he jetted off to South Africa.
Mandela is clinging to life at a hospital in Pretoria, an issue weighing heavily in the continent, where he retains massive popularity despite his retirement from public life.
His condition has improved, but his health remains delicate, said his ex-wife, Winnie Madikizela-Mandela.
"I can say that from what he was a few days ago, there is great improvement, but clinically he is still unwell," she told reporters.
Mandela became an international figure while enduring 27 years in prison for fighting apartheid, South Africa's system of racial segregation. He was elected the nation's first black president in 1994, four years after he was freed.
Even as he has faded from the spotlight, he remains popular worldwide.
Mandela, the U.S. president said, is a hero to him and many others.
"If and when he passes from this place, one thing I think we'll all know is that his legacy is one that will linger on throughout the ages," Obama said.
He said he had read Mandela's writings and speeches, and understood "that this was somebody who believed in that basic principle I just talked about -- treating people equally -- and was willing to sacrifice his life for that belief."
Obama's visit to South Africa will include a stop at Robben Island, where Mandela spent a majority of his decades in prison. The White House schedule does not include a visit with the anti-apartheid icon.
During a news conference Thursday in Dakar, Obama called on countries worldwide to decriminalize homosexuality, a day after the U.S. Supreme Court handed a major victory to proponents of same-sex marriage by striking down a key part of the Defense of Marriage Act.
Every group of people has a right to its own views, Obama said.
"But when it comes to how the state treats people -- how the law treats people -- I believe that everybody has to be treated equal," he said.
The remarks came in response to a question from CNN's Jessica Yellin on whether Obama was pressing his Senegalese counterpart on the issue. Homosexuality is illegal in Senegal.
"Senegal is a very tolerant country which does not discriminate in terms of inalienable rights of human beings," Senegalese President Macky Sall said. "People are not refused jobs for being gay," he said. "But we are still not ready to decriminalize homosexuality."
In Senegal, Obama also visited Goree Island, which once served as a strategic post in the transatlantic slave trade.
Obama will spend the weekend in South Africa and then head to Tanzania, his last stop before returning to Washington next week.
CNN's Josh Levs and Diane Ruggiero and contributed to this report.