(CNN) Former US President Barack Obama has urged people in leadership positions not to use social media in a way that fosters division.

In a BBC interview conducted by Britain's Prince Harry, Obama warned that the internet risked reinforcing people's prejudices and leading to a fractured society.

"All of us in leadership have to find ways in which we can recreate a common space on the internet," Obama said. "One of the dangers of the internet is that people can have entirely different realities. They can be cocooned in information that reinforces their current biases," he said.

Obama did not mention US President Donald Trump by name during the interview, which he said was his first since leaving office.

However, Trump's campaign and presidency have been characterized by his outspoken use of Twitter.

Obama, who was interviewed for an edition of the BBC Radio 4 Today program guest edited by Prince Harry and broadcast Wednesday, said it was a challenge to make the most of the opportunities provided by social media.

"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," he said in the interview, which was taped in September during the Invictus Games in Toronto, Canada.

Obama said it was important for people to get offline and meet others in their communities, "because the truth is that on the internet everything is simplified and when you meet people face to face it turns out they are complicated," he said.

"One of things we want to do I think is as we're working with young people to build up platforms for social change," he said. "Make sure that they don't think that just sending out a hashtag in and of itself is bringing about change. It can be a powerful way to raise awareness but then you have to get on the ground and actually do something."

Former US President Barack Obama and Prince Harry attend the Invictus Games 2017 in Toronto, Canada, in September.

'Work still undone'

Asked how he felt on the day he left office in January this year, Obama described mixed feelings.

"The sense that there was a completion, and that we had done the work in a way that preserved our integrity and left us whole and that we hadn't fundamentally changed, I think was a satisfying feeling," he said.

"That was mixed with all the work that was still undone and concerns about how the country moves forward. But overall there was a serenity there, more than I would have expected."

Obama also paid tribute to former First Lady Michelle Obama, describing her as a "spectacular, funny, warm person" who despite not being politically inclined herself had supported him throughout the process and been "as good of a First Lady as there has ever been."

Asked by Harry what was the biggest change for him after his eight years in office, Obama reflected on a slowed pace of life and the new freedom he had to decide how to focus his activities.

"The things that are important to me haven't changed, I still care about about making the United States and the world a place where kids get an education, where people who are willing to work hard are able to find a job that pays a living wage, that we are conserving the amazing resources of our planet so that future generations can enjoy the beauty of this place like we did," he said.

Obama said he now had to "rely more on persuasion than legislation" but that he enjoyed being able to focus his energies on the causes that mattered most to him.

Recounting what he missed about the presidency, Obama mentioned his team, the rewarding nature and intensity of the work they did -- and being able to travel without getting stuck in traffic.

Royal wedding invitation?

Questioned live on air after the pre-taped interview was broadcast, Prince Harry said the guest list has not yet been put together for his wedding to US actress Meghan Markle next May.

Asked if he got along well enough with the former President to invite him to the event, the Prince laughed off the question.

"Well, I don't know about that," he said. "We haven't put the invites or the guest list together yet so who knows whether he's going to be invited or not. I wouldn't want to ruin that surprise."