US President Barack Obama was caught snapping a selfie with British PM David Cameron and Danish premier Helle Thorning-Schmidt during the memorial service of former South African President Nelson Mandela. The image of the trio has caused a stir online.

As they posed for the photo, Obama and Cameron leaned towards Schmidt, who was seated between the two leaders. The US president captured the photo with the help of Thorning-Schmidt.

Meanwhile, US First Lady Michelle Obama seemed more focused on the memorial itself. Sitting directly next to her husband, she remained straight-faced while watching the ceremony.

The image has gone viral on Twitter and the hashtag #ObamaSelfie is quickly trending. Many users have made snarky remarks against the leaders, noting that “funerals are no place for selfies.”

@FlyoverCulture I've grimaced at people checking email before weddings. But taking an #obamaselfie at a funeral? Unbelievable. Low class. — Bill (@SaundersBill) December 10, 2013

Michelle Obama to White House kitchen staff: “Throw out all the danishes” <> #ObamaSelfie#MandelaMemorial#DanishPM — Cameron Gray (@Cameron_Gray) December 10, 2013

Dozens of world leaders joined thousands of South Africans on Tuesday at the memorial service for Mandela, who passed away on December 5 at the age of 95.

Addressing the crowd at the ceremony, Obama said, “Madiba makes me want to be better.” He referred to the late African leader as “the last great liberator of the 20th century.”

“For the people of South Africa, for those he inspired around the globe - Madiba’s passing is rightly a time of mourning, and a time to celebrate his heroic life.But I believe it should also prompt in each of us a time for self-reflection. With honesty, regardless of our station or circumstance, we must ask:how well have I applied his lessons in my own life?” he said.