WASHINGTON—The Chinese government systematically dismantled CIA spying operations in the country starting in 2010, killing or imprisoning more than a dozen sources over two years and crippling intelligence gathering there for years afterward.

Current and former U.S. officials described the intelligence breach as one of the worst in decades. It set off a scramble in Washington’s intelligence and law enforcement agencies to contain the fallout, but investigators were bitterly divided over the cause. Some were convinced that a mole within the CIA had betrayed the United States. Others believed that the Chinese had hacked the covert system the CIA used to communicate with its foreign sources. Years later, that debate remains unresolved.

But there was no disagreement about the damage. From the final weeks of 2010 through the end of 2012, according to former U.S. officials, the Chinese killed at least a dozen of the CIA’s sources. According to three of the officials, one was shot in front of his colleagues in the courtyard of a government building — a message to others who might have been working for the CIA.

Still others were put in jail. All told, the Chinese killed or imprisoned 18 to 20 of the CIA’s sources in China, according to two former senior U.S. officials, effectively unravelling a network that had taken years to build.

Assessing the fallout from an exposed spy operation can be difficult, but the episode was considered particularly damaging. The number of U.S. assets lost in China, officials said, rivalled those lost in the Soviet Union and Russia during the betrayals of both Aldrich Ames and Robert Hanssen, formerly of the CIA and the FBI, who divulged intelligence operations to Moscow for years.

The previously unreported episode shows how successful the Chinese were in disrupting U.S. spying efforts and stealing secrets years before a well-publicized breach in 2015 gave Beijing access to thousands of government personnel records, including intelligence contractors. The CIA considers spying in China one of its top priorities, but the country’s extensive security apparatus makes it exceptionally hard for western spy services to develop sources there.

At a time when the CIA is trying to figure out how some of its most sensitive documents were leaked onto the Internet two months ago by WikiLeaks, and the FBI investigates possible ties between President Donald Trump’s campaign and Russia, the unsettled nature of the China investigation demonstrates the difficulty of conducting counterespionage investigations into sophisticated spy services like those in Russia and China.

The CIA and the FBI both declined to comment.

Details about the investigation have been tightly held. Ten current and former U.S. officials described the investigation on the condition of anonymity because they did not want to be identified discussing the information.

The first signs of trouble emerged in 2010. At the time, the quality of the CIA’s information about the inner workings of the Chinese government was the best it had been for years, the result of recruiting sources deep inside the bureaucracy in Beijing, four former officials said. Some were Chinese citizens who the CIA believed had become disillusioned with the Chinese government’s corruption.

But by the end of the year, the flow of information began to dry up. By early 2011, senior agency officers realized they had a problem: Assets in China, one of their most precious resources, were disappearing.

The FBI and the CIA opened a joint investigation run by top counterintelligence officials at both agencies. Working out of a secret office in northern Virginia, they began analyzing every operation being run in Beijing. One former senior U.S. official said the investigation had been code-named Honey Badger.

As more and more sources vanished, the operation took on increased urgency. Nearly every employee at the U.S. Embassy was scrutinized, no matter how high ranking. Some investigators believed the Chinese had cracked the encrypted method that the CIA used to communicate with its assets. Others suspected a traitor in the CIA, a theory that agency officials were at first reluctant to embrace — and that some in both agencies still do not believe.

Their debates were punctuated with macabre phone calls — “We lost another one” — and urgent questions from the Obama administration wondering why intelligence about the Chinese had slowed.

The mole hunt eventually zeroed in on a former agency operative who had worked in the CIA’s division overseeing China, believing he was most likely responsible for the crippling disclosures. But efforts to gather enough evidence to arrest him failed, and he is now living in another Asian country, current and former officials said.

There was good reason to suspect an insider, some former officials say. Around that time, Chinese spies compromised National Security Agency surveillance in Taiwan — an island Beijing claims is part of China — by infiltrating Taiwanese intelligence, a U.S. partner, according to two former officials. And the CIA had discovered Chinese operatives in the agency’s hiring pipeline, according to officials and court documents.

Those who rejected the mole theory attributed the losses to sloppy U.S. tradecraft at a time when the Chinese were becoming better at monitoring U.S. espionage activities in the country. Some FBI agents became convinced that CIA handlers in Beijing too often travelled the same routes to the same meeting points, which would have helped China’s vast surveillance network identify the spies in its midst.

Some officers met their sources at a restaurant where Chinese agents had planted listening devices, former officials said, and even the waiters worked for Chinese intelligence.

Loading... Loading... Loading... Loading... Loading... Loading...

This carelessness, coupled with the possibility that the Chinese had hacked the covert communications channel, would explain many, if not all, of the disappearances and deaths, some former officials said. Some in the agency, particularly those who had helped build the spy network, resisted this theory and believed they had been caught in the middle of a turf war within the CIA.

By 2013, the FBI and the CIA concluded that China’s success in identifying CIA agents had been blunted — it is not clear how — but the damage had been done.

The CIA has tried to rebuild its network of spies in China, officials said, an expensive and time-consuming effort led at one time by the former chief of the East Asia Division. A former intelligence official said the former chief was particularly bitter because he had worked with the suspected mole and recruited some of the spies in China who were ultimately executed.

Read more about: