ALEXANDRIA, Va. -- A former government official accused of selling classified documents to China has been ordered free on bond despite government concerns that he could flee the country.

Kevin Mallory, 60, of Leesburg, Virginia, was arrested last week and charged under the federal Espionage Act. According to court documents, customs agents found him with $16,500 in undeclared cash earlier this year on a return trip from China.

Prosecutors argued at a detention hearing Thursday in Alexandria that Mallory should be jailed pending trial. A prosecutor said wigs and disguises were found in his home, and that Mallory has expertise in "tradecraft" that gives him the ability to flee the country.

Get Breaking News Delivered to Your Inbox

But a magistrate allowed Mallory to be released on an unsecured bond with home detention and electronic monitoring.

Mallory worked for the State Department from 1987 to 1990 and held various positions for federal agencies and government contractors until 2013, according to an affidavit written by an FBI agent in support of the criminal complaint. His top-secret security clearance was terminated in October 2012 when he left government service. He told investigators he was self-employed at GlobalEx, a consulting firm he founded in 2010.

Federal investigators searched Kevin Mallory's home in Leesburg, Va., home on Thu., June 22, 2017. WUSA-TV

Prosecutors allege Mallory, a U.S. citizen who speaks fluent Mandarin, traveled to Shanghai in March and April and met with a person who said he worked for the Shanghai Academy of Social Sciences (SASS), a Chinese think tank that the FBI said frequently provides cover for Chinese intelligence operatives.

According to the affidavit, Mallory consented to a search of a device he used to communicate with the Chinese operative during an interview with FBI agents on May 24. Investigators allegedly discovered messages on the device from Mallory to the operative in which he described obscuring classification markings on documents transmitted to the operative.

In one message on May 5, Mallory allegedly told the operative "your object is to gain information, and my object is to be paid for," according to the affidavit.