Former State Department agent with ‘top secret’ clearance faces life in prison for allegedly selling information.

A US defence contractor and former state department security officer was arrested by American counterintelligence officials and charged with spying for China.

The justice department said on Thursday that Kevin Mallory of Leesburg, Virginia, allegedly sold classified documents to Chinese intelligence agents on trips to Shanghai in March and April.

He could face up to life in prison if found guilty.

The content of the documents in question was not divulged but was characterised as “defence information” for which he received $25,000.

“Your object is to gain information and my object is to be paid,” Mallory told Chinese agents in a May 5 message, according to an indictment.

READ MORE: US presses China to do more to rein in North Korea

Mallory, 60, is a fluent Mandarin speaker who had served in the US Army, then as a special agent for the security service of the state department, before becoming a contractor to various government agencies.

Up until 2012, he had a “top secret” clearance level in positions in China, Taiwan, Iraq and Washington DC.

The Washington Post said Mallory had worked for the CIA.

The indictment said he made contact via social media in February with a Chinese “recruiter” who helped arrange a trip the next month to Shanghai to meet intelligence officials.

They were working under the guise of scientists with the Shanghai Academy of Social Sciences, according to the indictment.

They trained him in using a special communication device which, when examined by investigators, showed Mallory planning to hand over more documents.

Mallory was charged with delivering defence information to a foreign government and with making false statements to FBI agents.