Over the past few weeks, Google has begun warning people who use its Gmail service whenever it suspects that they might be targets of 'state-sponsored' hack attacks.

To do so, the company puts a message that says "We believe state-sponsored attackers may be attempting to compromise your account or computer" at the top of the Gmail pages of users that it believes are at risk.

The message will pop up in any browser, not just Google's Chrome.

Google has been coy about how it knows whether a specific individual has been targeted by attacks.

"We can't go into the details without giving away information that would be helpful to these bad actors," wrote Eric Grosse, Google's vice president of security engineering, in a blog.

But the company says it knows a state-sponsored attack when it sees one. "Our detailed analysis -- as well as victim reports -- strongly suggest the involvement of states or groups that are state-sponsored," Grosse said.

Google's ability to recognize such an attack may come from past experience. The company was victimized by Chinese hackers more than two years ago, and it has had to clean up several large-scale phishing and hacking campaigns directed at Gmail users.

This version of this story was originally published in Computerworld's print edition. It was adapted from an article that appeared earlier on Computerworld.com.

Read more about security in Computerworld's Security Topic Center.