Beijing (AFP) - A cartoon posted in a dusty alleyway in the heart of Beijing warns passersby not to fall prey to the charms of foreign men: they might be spies.

It is a graphic reminder of a struggle usually waged in the shadows, and a sign of the Chinese government's intensifying campaign against espionage.

The poster's comic book tale of love gone wrong ends in tears and a stern warning.

But China's real life spy games have had a darker denouement, according to a New York Times article Sunday alleging that authorities killed or jailed up to 20 people for spying on behalf of the US Central Intelligence Agency (CIA).

The counterintelligence operation took place between the end of 2010 and 2012, the Times said, an exceptionally sensitive period in Chinese domestic politics that saw the downfall of some of the country's most prominent politicians amid a delicate leadership transition.

In the years since, there has been a marked rise in warnings against the influence of so-called "black hands", with state media frequently fretting about the infiltration of "foreign forces" into domestic politics and society.

The rhetoric has been accompanied by a tightening of the domestic security environment, including a recent raft of sweeping legislation formalising the government's broad powers to counter threats from abroad.

In April last year, China passed a law placing strict restrictions on foreign NGOs, which are often accused by Beijing of trying to subvert the state and portrayed in Chinese media as fronts for US intelligence operations.

At the same time, Beijing ramped up a public campaign to raise awareness about the dangers of infiltration from abroad, ranging from the poster featuring the ill-fated lover to the promise of large cash rewards for informers.

Since coming to power in 2012, President Xi Jinping "has put a lot more emphasis and devoted a lot more resources to the internal state security apparatus," including "severe internal checkups" on officials, said political analyst Willy Lam.

The shift was part of an anti-corruption campaign that unseated China's domestic security czar Zhou Yongkang and its top spymaster Ma Jian.

Many of Washington's agents were likely recruited during Zhou's tenure, Lam said, when it was "relatively easy for people... to buy promotions and put their hands on sensitive information to provide to the US."

Following the changes, "both the US and Taiwan have faced more difficulty using the usual channels to recruit spies," he added.

- 'Numerous Chinese agents' ?

Asked about the Times story, China's foreign ministry said it had no comment on the "normal discharge of official duties by Chinese security organisations."

In an editorial Monday, the nationalist Global Times newspaper praised Beijing for rooting out the alleged traitors, writing that "international law will affirm that China's anti-espionage activities are just and legal, while the CIA's spying is illegitimate."

But US spying on China is not a one-way street.

In 1985, former spymaster Yu Qiangsheng gave the US government its first major intelligence victory against Beijing when he handed over information that led to the conviction of CIA analyst Larry Wu-Tai Chin on charges of spying for China for decades.

Since 2000, Washington has identified 154 Chinese agents, David Major, a former FBI special agent, told a US congressional committee last year.

A chart accompanying his remarks showed that over half of those had been outed since 2010, with the largest number exposed during the two-year period described in the Times story.

In early 2012, China arrested a top US informant who had likely revealed the "names of numerous Chinese agents", Major said.

He added that the informant, a former aide to one of China's top security officials, may have also turned over 56 Taiwanese nationals working for Beijing.

Chinese hackers are also believed to have masterminded the theft of the employment records of over 20 million US government workers.

- State secrets ?

"Covert subversion has been a toxic part of US-China relations since the beginning," said historian John Delury of South Korea's Yonsei University.

Ever since the Communists came to power in China in 1949, "there were active covert efforts to overthrow the regime," Delury said.

And there is no end in sight.

The brother of a senior aide to former president Hu Jintao has fled to the US, where he is rumoured to have shared some of China's most sensitive state secrets with Washington.

"The Chinese security and intelligence apparatus is very large and has very deep pockets," Paul Monk, an expert on Chinese intelligence, told AFP, adding that uncovering their activities was Washington's "highest priority."