President Barack Obama's handshake with Cuba's President Raul Castro Tuesday at a memorial service for the late South African leader Nelson Mandela was not "planned," a US official said.

"Nothing was planned" beyond Obama's speech in honor of Mandela, deputy US national security advisor Ben Rhodes told reporters traveling home with Obama on Air Force One.

"When he went to the podium, he shook hands with everyone on his way to speak. Really, he didn't do more than exchange greetings with those leaders," Rhodes said.

"The president's focus was on honoring the legacy of Nelson Mandela."

The handshake between the two leaders, whose countries have not had diplomatic relations for more than 50 years, dominated US news reports of the ceremony in memory of Mandela at a stadium in Soweto.

Obama offered the handshake before taking the stage to eulogize Mandela, but minutes later, made a clear swipe at states like Cuba, saying those who proclaim Mandela's legacy must honor its meaning by easing curbs on freedom.

In Cuba, a government website saw the gesture as a hopeful sign of possible "beginning of the end of the US aggressions."

Rhodes took pains to emphasize that the encounter between Obama and Castro did not signify a change in policy.

Since taking office in 2009, Obama had "taken a different approach in some important respects in relation to Cuba," Rhodes explained.

"At the same time we continue to have the same grave concerns about both the human rights situation in Cuba and Alan Gross, who we believe should be released immediately," he added.

Gross, 64, was arrested in December 2009 for distributing laptops and communications equipment to members of Cuba's small Jewish community under a State Department contract.

He was sentenced to 15 years in prison in March 2011 for "acts against the independence or territorial integrity" of the Communist-ruled island.

"We will continue to explore the type of openings that we've already undertaken. The president indicated a willingness to pursue a different path," Rhodes said.

"But at the same time, we would very much focus our policy on supporting greater human rights, dignity and opportunity for the people of Cuba, that would be in line with the type of values the president spoke about today."