FORMER US president Barack Obama has warned against using social media in a divisive way during an interview with Prince Harry.

Mr Obama did not mention his successor in the White House by name, but many will see the comments as a thinly veiled rebuke aimed at Donald Trump.

Questioned by Prince Harry as part of the royal’s guest editorship of BBC Radio 4’s flagship Today programme, Mr Obama said there was a danger of people becoming stuck in their biases due to social media use.

READ MORE: Scotland's Christmas gift to the world ... a massive tax hit for Donald Trump

The former president said: “The question, I think, really 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 Balkanisation of our society, but rather continues to promote ways of finding common ground?

“And, I’m not sure government can legislate that, but what I do believe is that all of us in leadership have to find ways in which we can recreate a common space on the internet.

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

President Trump has drawn widespread criticism for the way he uses Twitter to attack opponents, and condemn what he brands “fake news”.

Meanwhile, Prince Harry has joked he has yet to decide if Mr Obama will be invited to his wedding – after a report claimed Government sources said asking the statesman would infuriate President Trump.

Harry was quizzed about his wedding guest list when he edited BBC Radio 4’s Today programme yesterday – but he remained tight-lipped about whether Mr Obama will or will not receive an invite.

The prince will marry his fiancee Meghan Markle on May 19 during a wedding service held at Windsor Castle’s St George’s Chapel.

When asked by Today presenter Sarah Montague if Obama had been invited Harry replied: “I don’t know about that, we haven’t even put the invite or the guest list together, who knows if he’s going to be invited or not, I wouldn’t want to ruin that surprise.’’ Harry has been friends with Barack and Michelle Obama for more than four years, since the former First Lady and the prince started supporting each other’s projects helping military veterans.

READ MORE: Scotland's Christmas gift to the world ... a massive tax hit for Donald Trump

They have frequently visited each other, with Mr Obama agreeing to be interviewed by Harry when he edited the Today programme.

It is likely the prince will sit down with his fiancee and decide who they will invite in the new year, and probably make the decision without outside influence as it is essentially a private family wedding.

The Sun newspaper has reported that Harry wants the Obamas to attend his wedding, but that government officials feel it could be seen as a snub to Mr Trump.

The White House said in the run-up to Christmas it would announce details “soon” of Mr Trump’s proposed visit to the UK, amid growing expectations that he will come to London in February to open the new US Embassy.

READ MORE: Scotland's Christmas gift to the world ... a massive tax hit for Donald Trump

Prime Minister Theresa May’s offer of a state visit this year was put on hold amid fears of demonstrations against the US President, but there has been widespread speculation that he could open the embassy in Vauxhall, south London, on a more low-profile visit.