Facebook considered selling users' data to companies, despite a promise from Mark Zuckerberg never to do so.

The company mulled charging for access to user data several years ago, however ultimately it decided against it, The Telegraph understands. The news was first revealed by emails leaked to the Wall Street Journal.

Facebook says it has never sold its users' data to third parties, and Mark Zuckerberg pledged in 2009 that the company would never do so. However, the emails show that between 2012 and 2014 said that the company considered changing this.

In 2015, Facebook shut down a feature known as an API that allowed developers to see data about the friends of Facebook users that had installed their apps, such as their likes, birthdays and home town. The feature returned to prominence this year during the Cambridge Analytica scandal when it emerged that a researcher had exploited it to harvest the data of 87m users.

Instead of shutting the feature off completely, Facebook considered charging developers for continued access to the data, the emails revealed. It ultimately decided against the move.

The emails are part of court filings relating to a lawsuit against Facebook by a US-based software company Six4Three. The company sued Facebook in 2015, saying that its data practices were anticompetitive and favoured some companies over others.