Hackers based in China breached U.S. Office of Personnel Management computers, according to American officials, stealing records of as many as 4 million current and former federal employees in one of the largest breaches of government personnel data.

The hackers, believed to have links to the Chinese government, got into the computer system late last year, according to one U.S. official, who asked for anonymity to discuss the investigation. The intrusion was detected in April and it took U.S. investigators a month to conclude that the files had been compromised.

The attack is believed to be part of a larger effort by Chinese hackers to get health-care records and other personal information on millions of government employees and contractors from various sources, including insurers, government agencies and federal contractors, said a U.S. intelligence official, also speaking on condition of anonymity.

The data could be used to target individuals with access to sensitive information who have financial, marital or other problems and might be subject to bribery, blackmail, entrapment and other traditional espionage tools, the official said.

Another person familiar with the breach said the hackers accessed information about individuals who applied for or were granted security clearances. Such data often includes detailed interviews with friends and family members as well as information that could disqualify a candidate from receiving a clearance.

The target of the attack was a data center in Denver. The OPM systems were part of a center operated by the Interior Department for federal agencies, the Department of Homeland Security said in a statement.

The OPM provides information on job candidates for agencies across that federal government, including whether those individuals are suitable for government employment, according to the OPM website.

The Federal Bureau of Investigation and the Department of Homeland Security are investigating the hack, according to a statement from OPM.

A spokesman for the Chinese Embassy in Washington, Zhu Haiquan, said his country's laws prohibit cybercrimes and China works to combat violations.

"Cyber-attacks conducted across countries are hard to track and therefore the source of attacks is difficult to identify," he said in an e-mailed statement. "Jumping to conclusions and making hypothetical accusation is not responsible and counterproductive."

The federal government plans to notify those who were potentially affected by the breach, and is offering free credit report access, credit monitoring and identity-theft insurance to those whose personal information was compromised.

The OPM said investigators may find that additional personnel files were compromised as they review the breach.

"We take very seriously our responsibility to secure the information stored in our systems," OPM Director Katherine Archuleta said in the statement.

Donna Seymour, OPM's chief information officer, said the information stolen was typical for a personnel file, including Social Security number, date and place of birth and benefit selections. Bank accounts and health information weren't included and there's no indication any specific category of workers were targeted, she said.

The American Federation of Government Employees, the biggest union representing federal employees, said that the 4 million affected were roughly split between current federal employees and retirees and former workers. According to the OPM website, there are about 2.6 million civilian workers in executive branch departments.