Barack Obama
U.S. President Barack Obama points to a rice crop before it is processed as he visits a food security expo in DakarReuters

US President Barack Obama, who is on a six-day tour of Africa, is likely to visit Nelson Mandela if the family of the ailing former South African president allows him. He described him as a 'hero' ahead of his visit to South Africa on Friday.

Barack Obama's South African visit has been overshadowed by ill-health of the 94-year-old anti-apartheid icon, who has been put on a life-support system on Wednesday after his condition grew critical for the fourth consecutive day since his hospitalization for lung infection earlier this month.

The White House said that Obama's visit to Nelson Mandela is up to the family of the former president.

"We are going to completely defer to the wishes of the Mandela family and work with the South African government as relates to our visit," Ben Rhodes, deputy national security adviser, told reporters in Senegal. "Whatever the Mandela family deems appropriate, that's what we're focused on doing in terms of our interaction with them."

The US President recalled his meeting with the ailing anti-apartheid icon during his visit to Senegal, a day before arriving in Johannesburg.

"I've had the privilege of meeting Madiba and speaking to him. And he's a personal hero, but I don't think I'm unique in that regard," Obama said on Thursday. "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."

"When I was in law school in 1991, to see Nelson Mandela step forward after 27 years of captivity and not only help usher in democracy and majority rule - but as importantly for him to say, 'I embrace my former captors and my former oppressors, I believe in one nation, and I believe in judging people on the basis of their character and not their colour' - gave me a sense of what is possible in the world when righteous people ... work together on behalf of a larger cause," he told The Guardian. 

Mandela's health has been a concern ever since he was hospitalised for a lung injection earlier this month. Well-wishers have been praying for their hero outside the hospital in Pretoria where he is undergoing treatment. President Jacob Zuma had cancelled his visit to Mozambique on Thursday after paying a visit to Mandela.

Obama, who is expected to address the "Feed the Future" event on food security, anti-corruption measures and trade relations with South Africa, is scheduled to visit Robben Island, where Mandela spent many years in prison.

The US President has drawn criticism for not visiting Africa, though he is from this part of the world. He has visited Africa (Ghana) only once since becoming the President of United States in 2009.