Google moved quickly to announce that it would stop censoring its Chinese service after realising dissidents were at risk from attempts to use the company's technology for political surveillance, according to a source with direct knowledge of the internet giant's most senior management.

China this morning issued a statement saying it resolutely opposed hacking and was itself a victim of cyber attacks, in its first response to Google's hacking claims. In a statement posted on the state council information office website, cabinet spokesman Wang Chen reminded companies of their need to abide by internet controls, citing their "social responsibilities". The remarks did not mention Google directly. The source told the Guardian the company's decision was largely influenced by the experiences of Sergey Brin's Russian refugee background.

The Google co-founder "felt this very personally", the source said.

"The notion that somebody would try to turn Google's tools into tools of political surveillance was something he found deeply offensive."

When it became clear that the cyber attacks were about political surveillance, people at the very top of the company "decided they no longer wanted to participate in this kind of behaviour," said the source.

"It was felt that whether it's censorship or whether it's surveillance or threats to people who speak out this is all about suppression of free speech and was something the company no longer felt in conscience they could stand by that."

The US government intervened in the confrontation yesterday, urging Beijing to answer Google's claim of a massive hacking attack. Chinese authorities initially responded cautiously to Google's announcement. In the government's first public remarks, an official said it was "seeking more information". The unnamed official from China's state council information office – the cabinet spokesman's office – added: "It is still hard to say whether Google will quit China or not. Nobody knows."

It is thought that as many as 20 other companies including internet and mobile phone businesses were also being attacked in order to carry out political surveillance, or industrial espionage, according to the source. Google acknowledged that it might have to withdraw from China.

The US secretary of state, Hillary Clinton, said: "We have been briefed by Google on these allegations, which raise very serious concerns and questions. We look to the Chinese government for an explanation. The ability to operate with confidence in cyberspace is critical in a modern society and economy."

Google is understood to want to try to work with Beijing, according to the senior company source, who added it was "hopeful that they can accept that this is a new century, it's a new time. I don't think it's the Chinese government as a whole … but I think there are some left over elements of totalitarianism in China, be it in government or be it in hackers or what not. But those elements – it's time for them to go. It's time the Chinese people had unfettered access to information."

In a CNBC interview, David Drummond, senior vice-president of corporate development, chief legal officer, and author of the Google announcement, said: "We are not saying one way or the other whether the attacks are state-sponsored or done with any approval of the state.

"We do know that it was very organised and the attack came from China and political dissidents and people interested in human rights in China were clearly targeted."

Google spoke to the Chinese government yesterday but has not disclosed what form the contact took or who was involved.

"We have talked to the Chinese authorities and we will be talking to them more in the coming days," it said.

The Google source said the company decided to move quickly once it realised what was happening because they felt "a moral obligation to the dissidents to let them know they might be at risk".

"Unfortunately we could see the dark side of technology, when they tried to subvert the things we're building into tools of political suppression, which is the ultimate inverse of everything we stand for. So that was also troubling, but the connection, once we saw and understood – that's when it really hit home." News portals in China were reportedly told to downgrade coverage of the issue, but articles on several sites including the English language Xinhua site carried accounts of Google's decision, including references to censorship, but not hacking.

While campaign groups such as Human Rights Watch praised the firm's decision, it received a mixed reception in Beijing, even among admirers. Several people left flowers at the entrance to its headquarters, along with a sign reading: "Google – a real man."

But prominent liberal blogger, Ran Yunfei, wrote: "Google leaving China is definitely not good news." Comparing the company to dissidents who emigrate, he added: "Those who would remain are obedient citizens and [that is] satisfactory to the authorities."

Isaac Mao, a Chinese blogger who in 2007 published a widely circulated open letter to the firm criticising it for self-censorship, said: "I think Google has eventually made the right decision to fight back based on their principles."

When it launched google.cn in 2006, the company said it believed the benefits of increased access to information for people in China outweighed the negative impact of self-censorship. But it was widely criticised for the decision. Google has around a third of the Chinese search market, lagging far behind the domestic firm Baidu. Kaiser Kuo, a Beijing-based expert on the internet, said: "There are two schools of thought on this. One says that this is a mere smokescreen of sanctimony meant to hide a retreat from a market Google was unable to conquer for business reasons ... The other is that this is a true act of moral bravery."

White House spokesman Robert Gibbs said Google had briefed the Obama administration before its China announcement. He said the president believed in the "freedom of the internet".