A former US Defense Intelligence Agency official will be jailed for 15 years after pleading guilty Friday to charges of attempting to sell classified information to the Chinese, the Department of Justice said.

Ron Rockwell Hansen, 58, a former DIA operative based in Beijing, was arrested in June while preparing to board a flight to China carrying classified information.

Investigators said Hansen, a fluent Mandarin Chinese and Russian speaker, had fallen into deep financial trouble from 2013 to 2016 and was paid more than $800,000 by Chinese intelligence for US secrets.

During that time they found that he had regular meetings with Chinese intelligence agents that he never reported, used cellphones provided him by Chinese sources and retained classified information to which he was not supposed to have access.

They discovered his work with the Chinese when in 2016 he tried to recruit a fellow intelligence case officer to work with him and the colleague reported it to their superiors.

In a deal with prosecutors Hansen pleaded guilty to one count of attempting to gather or deliver national defense information to aid a foreign government.

The deal set his sentence at 15 years.

US intelligence has been struggling hard against a Chinese espionage offensive that saw the CIA’s Chinese informant network rolled up by Beijing several years ago, and saw several US officials exposed as Chinese spies.

In January 2018, former CIA agent Jerry Chun Shing Lee was arrested on charges that he sold information to China. He is reportedly suspected of having provided information that allowed China to bring down the CIA’s network between 2010 and 2012.

Former State Department official Kevin Mallory was arrested in 2017 for spying for China.

And another US diplomat, Candace Marie Claiborne, was also arrested for taking money from Chinese intelligence officials, though she was not directly accused of supplying information in exchange.