British Prime Minister David Cameron, Denmark’s Prime Minister Helle Thorning Schmidt and President Obama take a selfie during the memorial service for Nelson Mandela. (ROBERTO SCHMIDT/AFP/Getty Images)

The handshake and the selfie.

On a day when President Obama delivered a stirring eulogy for Nelson Mandela, the South African leader to whom he credits the origins of his political stirrings, much of the media’s attention was focused on two unplanned moments steeped — rightly or wrongly — with meaning by political observers.

First was the handshake between Obama and Cuban President Raul Castro, repeated incessantly in video clips. As Obama made his way to the podium to speak at the memorial for Mandela in a Soweto soccer stadium, he walked down a line of dignitaries, greeting other leaders in attendance. Obama neither made a special effort to shake Castro’s hand nor to avoid him.

“Nothing was planned in terms of the president’s role other than his remarks,” deputy national security adviser Ben Rhodes said about the handshake.

But Sen. John McCain (Ariz.), Obama’s Republican opponent in the 2008 presidential campaign, was quick to pounce, saying that Obama should not have extended his hand to Castro.

At a memorial service for Nelson Mandela on Tuesday, President Obama shook hands with Cuban President Raúl Castro. Here's why it's not a big deal. (The Washington Post)

McCain said, “It gives Raul some propaganda to continue to prop up his dictatorial, brutal regime, that’s all.”

Taking a different tack, Sen. Marco Rubio (R-Fla.) declined to criticize the handshake, instead saying that Obama should have taken the opportunity to press Castro on human rights issues. (Rubio is Cuban American.)

In his remarks, Obama didn’t address Cuba or Castro directly, but he did refer to leaders who don’t respect human rights — words that could be read as implicitly addressing the Castro regime.

“There are too many leaders who claim solidarity with Madiba’s struggle for freedom, but do not tolerate dissent from their own people,” Obama said, using Mandela’s tribal name.

Then there was the case of the selfie seen ’round the world. While seated in the crowd at the Mandela memorial, Obama was seen taking a self-portrait with British Prime Minister David Cameron and Danish Prime Minister Helle Thorning-Schmidt. (To be precise, Obama and Thorning-Schmidt were actually holding the phone; Cameron was just leaning in to make it into the shot.) Adding to the drama? First lady Michelle Obama could be seen in the photo staring into the distance with a less-than-thrilled expression on her face.

Cue furious social-media debate about the appropriateness of a U.S. president acting like a bored kid at a school assembly during a funeral for a world leader. “Can you believe it, Obama taking selfies at the Nelson Mandela memorial?” said conservative radio host Rush Limbaugh.

All of it serves as a reminder — as if we needed one — that even the best-laid plans of politicians tend to veer wildly off course in this age of social media. Moments are everything now, all captured for posterity by thousands of camera clicks and keyboard taps that can go viral as quickly as it took Obama to read the opening few lines of his speech.