Former President Barack Obama took a veiled swipe at President Trump, warning against the irresponsible use of social media by people who are in positions of power.

"All of us in leadership have to find ways in which we can recreate a common space on the Internet," Obama said.

Obama, who was interviewed by Prince Harry for the BBC, did not mention Trump by name, though his comments appeared to be directed at Trump who frequently takes to Twitter to express himself.

“One of the dangers of the Internet is that people can have entirely different realities,” Obama said. “They can be cocooned in information that reinforces their current biases.”

“The question has to do with how do we harness this technology in a way that allows a multiplicity of voices, allows a diversity of views, but doesn’t lead to a Balkanization of society and allows ways of finding common ground.”

Obama urged face-to-face contact to help combat extreme views.

"Social media is a really powerful tool for people of common interests to convene and get to know each other and connect. But then it's important for them to get offline, meet in a pub, meet at a place of worship, meet in a neighborhood and get to know each other,” he said. "Because the truth is that on the internet, everything is simplified and when you meet people face-to-face it turns out they're complicated."