Taiwanese lawmakers on both sides of the aisle have reached a bipartisan consensus to amend the island’s national security law to penalize locals and foreigners found establishing or financing spy rings for an adversary power.

The amendment, passed earlier this week at the Legislative Yuan, will mete out harsher sentences and fines for spying for China than for other foreign authorities.

For instance, those found recruiting informants at Beijing’s behest would be subject to no less than seven years in prison and a fine of up to NT$100 million (US$3.19 million). By comparison, those guilty of helping other foreign nations would face imprisonment of three years and a maximum fine of NT$30 million.

Taiwanese employed by the government, the military, state-owned enterprises and research and tertiary institutions who are convicted of espionage or divulging state secrets would also risk losing their pension and those offenders who have already retired would be mandated to return their pension payments and other benefits received.

Lawmakers will also debate supplementary resolutions on how to define mainland China as well as Macau and Hong Kong within the rubric of “hostile foreign forces,” as previous legislation against espionage mainly applied to foreign nationals.

Taiwan’s Trade Secrets Act will also be amended to boost penalties for corporate espionage.

The backdrop of increasing penalties to combat espionage is an admission from Taiwan’s national security agency that the island’s government agencies and major commercial entities are now “crawling with spies,” especially those loyal to China, who poke around for all sorts of information ranging from the army’s defense strategy to President Tsai Ing-wen’s medical records.

One such case involved a retired army major-general and former commander of the Air Defense Missile Command, who was put under investigation for allegedly leaking classified information to China, although prosecutors later dropped the charges against him.

Last year, a book published by a former deputy chief of the Military Intelligence Bureau, Lieutenant-General Wong Yen-ching, revealed that the People’s Liberation Army’s cyberspace unit known as the “No. 6 Bureau” based in the central city of Wuhan maintained and updated the digital files of all Taiwanese military personnel from the rank of colonel and above, including information as specific as their places of residence, educational background and family members.

Wong suspected that the army of PLA hackers and spies operating on the self-ruled island contributed greatly to these profiles.

Another case revealed in the book involved a Taiwanese diplomat-turned-general who was goaded into spying for Beijing by agents from the PLA’s Taiwan Special Division. Lo Hsien-che, a military attaché to the island’s de facto embassy in Bangkok from 2002 to 2005, maintained behind-the-scenes contacts with Chinese agents during his stint there. Lo was convicted and sentenced to life imprisonment in 2011.

To counter Beijing’s espionage activities, the Taiwanese military has reportedly carried out unannounced “loyalty tests” and has required military personnel to inform supervisors of their contact with any Chinese nationals. There is also a cash reward on offer for reporting a Chinese spy.