Barack Obama talked “obsessively” with his advisory team about the dangers of pro-Trump fake news websites before the election, it has emerged.

It is thought hundreds of invented articles promoting Donald Trump and slandering Hillary Clinton which went viral in the run-up to polling day may have contributed to the Republican's election victory.

Hoax stories, including reports Pope Francis had endorsed Mr Trump and claims that Bill Clinton had a secret son, are said to have received more attention than real stories on Facebook, leading to claims that the social media giant unfairly helped Mr Trump.

But while the significant role played by fake news emerged only after Mr Trump’s victory, Mr Obama’s team was clearly worried about the risks such online news sources posed to Ms Clinton’s chances during the campaign, according to the editor of The New Yorker.

First-hand accounts by David Remnick of time he spent with the Obama camp in the days before the election reveal the in-depth conversations that took place between the President and his aides, in which they discussed a new "media ecosystem" in which "facts and truth don't matter".

Four days before the election, after Mr Obama had reportedly talked “obsessively” with his senior advisor, David Simas, about reports of a “digital gold rush” that was seeing pro-Trump websites cropping up at an alarming rate and gaining hundreds of thousands of Facebook followers.

Mr Remnick detailed how the pair discussed the emergence of “wildly sensationalist” websites, such as TrumpVision365.com and WorldPoliticus.com, which they said were able to exist thanks to “a whole new permission structure” created by social media that provided “validation” for their opinions.

The President later spoke to Mr Remnick about the issue, describing Mr Trump's tactic of using the new media structure to "attract attention" and "rouse emotions".

Mr Obama said: “The lens through which people understand politics and politicians is extraordinarily powerful. And Trump understands the new ecosystem, in which facts and truth don’t matter.

“You attract attention, rouse emotions, and then move on. You can surf those emotions. I’ve said it before, but if I watched Fox, I wouldn’t vote for me!”

Mr Simas spoke of a “foundational change” that was changing the “parameters of acceptable discourse” following the emergence of social media.

“The continuum has changed. Had Donald Trump said the things he said during the campaign eight years ago – about banning Muslims, about Mexicans, about the disabled, about women – his Republican opponents, faith leaders, academia would have denounced him and there would be no way around those voices.

“Now, through Facebook and Twitter, you can get around them. There is social permission for this kind of discourse. Plus, through the same social media, you can find people who agree with you, who validate these thoughts and opinions.

"This creates a whole new permission structure, a sense of social affirmation for what was once thought unthinkable.”

In pictures: US Elections 2016 Show all 15 1 /15 In pictures: US Elections 2016 In pictures: US Elections 2016 Democratic U.S. presidential candidate Bernie Sanders speaks to supporters after rival candidate Hillary Clinton was projected as the winner in the Nevada Democratic caucuses Reuters In pictures: US Elections 2016 Democratic presidential candidate Hillary Clinton takes photos with workers at her campaign office in Des Moines, Iowa AP In pictures: US Elections 2016 Republican presidential candidate Mike Huckabee, second from left, prays before lunch with supporters at Drake Diner in Des Moines, Iowa Reuters In pictures: US Elections 2016 Democratic presidential candidate and former Maryland Governor. Martin O'Malley, speaks during a campaign stop in Waterloo, Iowa AP In pictures: US Elections 2016 Democratic presidential candidate Bernie Sanders speaks, as his wife Jane O’Meara Sanders looks on, at a campaign event at Iowa State University Getty In pictures: US Elections 2016 Republican presidential candidate Marco Rubio speaks at St. Ambrose University in Davenport, Iowa Reuters In pictures: US Elections 2016 Republican presidential candidate Ben Carson speaks at a campaign event at Fireside Pub and Steak House in Manchester, Iowa. Getty In pictures: US Elections 2016 Republican presidential candidate Rick Santorum visiting supporters at a house party in West Des Moines, Iowa Reuters In pictures: US Elections 2016 Republican presidential candidate Donald Trump at a campaign event in Cedar Rapids, Iowa AP In pictures: US Elections 2016 Republican candidate Ted Cruz campaigns at Greene County Community Centre in Jefferson, Iowa AP In pictures: US Elections 2016 Senator Rand Paul speaks during a Caucus rally at his Des Moines headquarters in Iowa Getty In pictures: US Elections 2016 Republican candidate Jeb Bush speaks at a campaign event in Des Moines, Iowa AFP In pictures: US Elections 2016 Former Alaska Governor Sarah Palin introducing the arrival of Donald Trump during a campaign rally in Cedar Rapids, Iowa Reuters In pictures: US Elections 2016 A portrait of Democratic candidate Bernie Sanders at his campaign headquarters in Des Moines, Iowa Getty In pictures: US Elections 2016 Campaign badges on sale ahead of a Trump rally at the Ramada Waterloo Hotel and Convention Centre in Waterloo, Iowa Getty

Since Mr Trump's presidential victory, Mr Obama has spoken out publicly on the issue of fake news. During his recent visit to Germany, the President warned the lack of “distinctions” between “what is true and what’s not” posed a threat to democracy, saying: “If we can’t discriminate between serious arguments and propaganda, then we have problems.

"And we can lose so much of what we’ve gained in terms of the kind of democratic freedoms and market-based economies and prosperity that we’ve come to take for granted.”

Following the accusations made against Facebook, the social media giant’s co-founder Mark Zuckerberg argued the hoaxes were not limited to one viewpoint and claimed it was “extremely unlikely” they had contributed to Mr Trump’s victory.