A Facebook software bug made the private posts of 14m people public, regardless of their privacy settings, the social network has admitted.

Facebook said the flaw, which affected users over several days in May, had now been fixed. It is the latest privacy issue to hit the social network.

On Facebook, users can select whether to send posts out to "friends only" or to make them "public", which means anybody can see them. The bug caused Facebook to automatically suggest posts be free for the world to see, no matter what the settings were.

Erin Egan, Facebook chief privacy officer, said the bug had been fixed and did not affect older posts. "We'd like to apologise for this mistake," she added.

The issue occurred between May 18 and 27. Facebook will be sending a notification to all users who were affected.

Facebook said the bug occurred when it was testing a new "featured items" tool for user profiles, which would give them a new way to share certain posts publicly.

However, this caused all posts from affected users to be set to public. The feature was only being tested on some profiles, rather than the whole of Facebook.