The company says the malware came from an infected website from a mobile developer.

Facebook security discovered that our systems had been targeted in a sophisticated attack," the company said in a blog post.

"The attack occurred when a handful of employees visited a mobile developer website that was compromised.

"We remediated all infected machines, informed law enforcement, and began a significant investigation that continues to this day."

The social network, which says it has more than 1 billion active users worldwide, said it was not the sole target.

"It is clear that others were attacked and infiltrated recently as well," the company said.

Facebook's announcement follows recent cyber attacks on other prominent websites.

Microblogging site Twitter said this month that it had been hacked, and that approximately 250,000 user accounts were potentially compromised, with attackers gaining access to information including user names and email addresses.

Newspaper websites including The New York Times, The Washington Post, and The Wall Street Journal have also been infiltrated.

Those attacks were attributed by the news organisations to Chinese hackers targeting their coverage of China.