Internet search firm Google is finalizing a deal that would let the National Security Agency help it investigate a corporate espionage attack that may have originated in China, the Washington Post reported on Thursday.

The aim of the investigation is to better defend Google, the world's largest Internet search company, and its users from future attacks, the Post said, citing anonymous sources with knowledge of the arrangement.

The sources said Google's alliance with the NSA -- the intelligence agency is the world's most powerful electronic surveillance organization -- would be aimed at letting them share critical information without violating Google's policies or laws that protect the privacy of online communications.

NSA is not able to comment on specific relationships we may or may not have with U.S. companies, the agency said in a statement.

As a general matter, NSA works with a broad range of commercial partners and research associates on security solutions for the Defense Department and other customers and on cutting-edge technologies that will secure the information systems of tomorrow, the statement said.

Under the arrangement, the NSA would not be viewing user searches or e-mail accounts, the Washington Post said. Google also would not be sharing proprietary data with the NSA, the newspaper's sources said.

Google took the unusual step on January 12 of announcing that it had been hit by sophisticated cyberattacks in mid-December and that it was reviewing its business operations in China.

The Silicon Valley-based firm said the cyberattacks targeted Gmail accounts of Chinese human rights activists and an investigation found at least 20 other large companies had been targeted by cyberattacks.

China responded several days later with a defense of its state control of the Internet. A top official said online pornography, fraud and rumors were a menace and that Internet media must help guide public opinion in China.

U.S. Director of National Intelligence Dennis Blair said on Tuesday the cyberattacks against Google were a wake-up call.

A partnership between the Internet search giant and the NSA touches on the sensitive issue of how to balance individual privacy and national security online.

Google approached the NSA in the aftermath of the attacks, but reaching an agreement has taken weeks because of the sensitive nature of information-sharing between the two sides, the Post quoted its sources as saying.

The focus of the cooperative venture would not be to determine who was behind the attacks, the newspaper added, citing its sources. That would be nearly impossible.

Instead the aim is to build a better defense of Google's networks, or what technicians call information assurances, the newspaper quoted the sources as saying.

(Writing by David Alexander, reporting by Tabassum Zakaria; Editing by Paul Simao)