Google will warn Gmail users if it suspects they are being targeted by state-sponsored cyber attacks, it has announced.

The search giant has previously accused China of meddling with its Gmail platform to target anti-government campaigners there. Although it is not directly accusing any nation in this announcement, it is a safe bet that its eyes are cast towards China. The company had previously announced attacks on Gmail were part of the reason it pulled out of China.

"We are constantly on the lookout for malicious activity on our systems, in particular attempts by third parties to log into users’ accounts unauthorised. When we have specific intelligence — either directly from users or from our own monitoring efforts — we show clear warning signs and put in place extra roadblocks to thwart these bad actors," the company said on its blog.

A warning would appear at the top of the Gmail inbox, telling a user that Google suspects, "state-sponsored attackers may be attempting to compromise your account or computer." The user would then be prompted to enhance security, for example by adding two-factor identification.

The blog, by Eric Grosse, VP security engineering, didn’t go into details of how Google would know that the attacks are state-sponsored as that would provide the attackers with information on which methods are successful and which are not.

"You might ask how we know this activity is state-sponsored. We can’t go into the details without giving away information that would be helpful to these bad actors, but our detailed analysis — as well as victim reports — strongly suggest the involvement of states or groups that are state-sponsored," Grosse said.

Google and China have shared an uneasy relationship over the last few years. Back in January 2010 the US company threatened to pull out of China over "highly sophisticated and targeted attack" on its systems that it claimed originated from China. It also said the accounts of "dozens" of Gmail users who are advocates of human rights in China appear to have been routinely accessed by third parties."

Google then stopped censoring its search results in the country by redirecting users in China to its Hong Kong site. In March 2011 Google again accused China of meddling with Gmail.