Facebook will now warn people if it has a strong suspicion an account is being targeted by a nation-state.

The social networking service already takes steps to secure accounts that may have been compromised but has decided to directly alert users of the type of attack that's under way, wrote Alex Stamos, Facebook's chief security officer.

Since state-sponsored attacks can be more sophisticated "having an account compromised in this manner may indicate that your computer or mobile device has been infected with malware," he wrote.

"Ideally, people who see this message should take care to rebuild or replace these systems if possible," Stamos wrote.

The warning advises people to turn on a security feature called login approvals. When Facebook sees someone logging on from a different browser or computer, it sends a one-time passcode to their mobile phone that must be entered in order to access the account.

Screenshot

Facebook can be an incredibly valuable resource if an attacker can gain the login credentials to someone's account.

A person's messages can be analyzed for sensitive information, and their contact list may be useful for figuring out relationships.

It also gives an attacker an easy way to target other people related to the person. A malicious message could be crafted that would appear to come from a known contact, making it more likely that a victim would trust it.

A variety of ways are used to attribute cyberattacks to a particular group or country, but it's not an exact science. Security experts may get clues from the servers used to mount an attack or a particular type of malware or exploit used to attack a computer.

But attackers usually have stealth on their side. They can use methods or infrastructure that make it either confusing or impossible to definitively source. For its part, Facebook doesn't plan on sharing more information than the warning.

"To protect the integrity of our methods and processes, we often won't be able to explain how we attribute certain attacks to suspected attackers," Stamos wrote. "That said, we plan to use this warning only in situations where the evidence strongly supports our conclusion."