Image copyright AFP Image caption Chinese police guard the US embassy in the capital, Beijing

Up to 20 CIA informants were killed or imprisoned by the Chinese government between 2010 and 2012, the New York Times reports, damaging US information-gathering in the country for years.

It is not clear whether the CIA was hacked or whether a mole helped the Chinese to identify the agents, officials told the paper.

They said one of the informants was shot in the courtyard of a government building as a warning to others.

The CIA did not comment on the report.

Four former CIA officials spoke to the paper, telling it that information from sources deep inside the Chinese government bureaucracy started to dry up in 2010. Informants began to disappear in early 2011.

The CIA and FBI teamed up to investigate the events in an operation one source said was codenamed Honey Badger.

The paper said this investigation had centred on one former CIA operative but there was not enough evidence to arrest him. He now lives in another Asian country.

In 2012, an official at China's security ministry was arrested on suspicion of spying for the US. He was said to have been lured into the CIA. No other such arrests appear to have reached public attention during that time.

Obama questioned slow intelligence

Matt Apuzzo, a New York Times journalist who worked on the story, told the BBC: "One of the really troubling things about this is that we still don't know what happened.

"There's a divide within the American government over whether there was a mole inside the CIA or whether this was a tradecraft problem, that the CIA agents got sloppy and got discovered, or whether the Chinese managed to hack communications."

A few years later in 2015, the CIA pulled staff out of the US embassy in Beijing, after a hack blamed on the Chinese state exposed information about millions of US federal employees. If the events of 2010-2012 were helped by a similar hack, it was not one that was made public.

The disappearance of so many spies damaged a network it had taken years to build up, the New York Times reports, and hampered operations for years afterwards, even prompting questions from within the Obama administration as to why intelligence had slowed.

Officials said it was one of the worst security breaches of recent years.

By 2013, the Chinese government seemed to have lost its ability to identify US agents and the CIA moved back to trying to rebuild its network.

Media playback is unsupported on your device Media caption Last year, China warned government officials to watch out for spies - and not fall in love with them

Mr Apuzzo continued: "For many years China and the US have been locked in this spy battle that's been going on behind the scenes. While doing this story we uncovered that Chinese intelligence have been able to infiltrate an NSA outpost in Taiwan. It goes back and forth."

The story was published during a temporary vacuum at the top of diplomatic relations between the two countries.

The Trump administration has named Terry Branstad, who is the governor of Iowa, as its ambassador to China but he has not yet moved to Beijing.

Cui Tiankai, China's ambassador to the US, has not commented, but in a recent press release, he mentioned "the current positive momentum that the China-US relationship enjoys".