On his way to the podium at the memorial ceremony for former South African president Nelson Mandela, President Obama walked down the line of dignitaries, greeting other leaders there to pay their respects. Among the hands shaken: that of Cuban leader Raul Castro.

Obama neither made a special effort to shake Castro’s hand nor to avoid him. A snub might have been awkward: In his speech, Obama praised Mandela’s “greatest gift” as “his recognition that we are all bound together in ways that can be invisible to the eye; that there is a oneness to humanity; that we achieve ourselves by sharing ourselves with others, and caring for those around us.”

The U.S. president also greeted Brazilian President Dilma Rousseff, who has filed a formal protest with the United States and rebuked the National Security Agency for its eavesdropping on world leaders.

Obama has criticized the Cuban government’s restrictions on civil rights but also said the United States must “find new mechanisms and tools” to deal with the nation. His administration has eased restrictions on American travel to Cuba and negotiated over issues including immigration, postal services and possible oil spills.

In September 2000, then-President Bill Clinton and Fidel Castro shook hands at the United Nations in what Secretary of State Madeleine Albright called a “chance encounter.” It was believed to be the first time Castro had shaken hands with a sitting U.S. president.

More on Nelson Mandela:

'The Last Great Liberator': Why Mandela made and stayed friends with some of the world's nastiest dictators

9 questions about Nelson Mandela you were too embarrassed to ask

Read the most important speech Mandela ever gave