Facebook was a key influencer in the outcome of the 2016 US presidential election and the Brexit vote, according to those who ran the campaigns.
But critics say it is a largely unregulated form of campaigning.
Those in charge of the digital campaigns for Donald Trump's Republican Party and the political consultant behind Leave EU's referendum strategy are clear the social network was decisive in both wins.
Political strategist Gerry Gunster, from Leave EU, told BBC Panorama that Facebook was a game changer for convincing voters to back Brexit.
"You can say to Facebook, 'I would like to make sure that I can micro-target that fisherman, in certain parts of the UK, so that they are specifically hearing that if you vote to leave you will be able to change the way that the regulations are set for the fishing industry'.
"Now I can do the exact same thing for people who live in the Midlands who are struggling because the factory has shut down. So I may send a specific message through Facebook to them that nobody else sees."
Gary Coby, the director of advertising for the Republican Party, says Facebook was also the key to Trump's victory.
He said the party used data about potential voters to reach them on social media, adding: "So if you are on Facebook, I can then match you and put you into a bucket of users that I can then target."
Mr Coby confirmed the official Trump campaign alone had spent in the region of $70m on Facebook over the election period.
"The way we bought media on Facebook was like no one else in politics has ever done."
Panorama has also been told Facebook had teams of people working directly with both the Democratic and Republican campaigns.
Simon Milner, Facebook's head of policy UK, confirmed that people from Facebook worked with the two campaigns, but declined to say how many.
"One of the things we are absolutely there to do is to help people make use of Facebook products. We do have people whose role is to help politicians and governments make good use of Facebook.
"I can't give you the number of exactly how many people worked with these campaigns. But I can tell you that it was completely demand driven, so it was really up to the campaigns."
The social network says it complies with all regulations but the platform, which is also expected to play a key role in the British general election on 8 June, has been criticised for being unaccountable when it comes to politics.
A quarter of the world's population now use Facebook, including 32 million people in the UK. Many use Facebook to stay in touch with family and friends and are unaware that it has become an important political player.
For example, the videos that appear in people's news feeds can be promoted by political parties and campaigners.
The far-right group, Britain First, has told Panorama how it paid Facebook to repeatedly promote its videos. It now has more than 1.6 million Facebook followers.
Damian Collins, chairman of the Culture, Media and Sport Committee in the outgoing parliament, says Facebook needs to be more accountable.
"Historically, there have been quite strict rules about the way information is presented and broadcasters work to a very strict code in terms of partiality and there are restrictions on use of advertising.
"But with something like Facebook you have a media which is increasingly seen as the most valuable media in an election period but which is totally unregulated."
Facebook says it is committed to assisting civic engagement and electoral participation, and that it helped two million people register to vote in the US presidential elections.
- Watch Panorama on BBC One at 19:30 BST on 8 May 2017. It will be available shortly after on BBC iPlayer.