He was passed to a Chinese intelligence operative working for a think tank who wanted him to become an informant. And over the next four months, Mr. Mallory, who is fluent in Mandarin Chinese, traveled to Shanghai, had covert communications with the operative on a Chinese-provided phone and passed information — including an unclassified white paper on American intelligence policy — to his handlers, the authorities said.
But Chinese attempts to protect the contents of the phone from prying eyes failed because of an apparent technical problem. The F.B.I. was able to analyze it and found a handwritten index describing eight documents. Four of the documents listed in the index were found on the phone, with three containing classified information.
The twist in Mr. Mallory’s spy career was that he told the F.B.I. and the C.I.A. parts of the story and provided his phone to agents. This was evidence that Mr. Mallory was not a spy, his lawyers said.
The prosecution said that story was “totally and completely absurd.” Mr. Mallory, prosecutors said, selectively disclosed his contacts in order to have a potential defense in case federal investigators caught on to his true plan: to trade American secrets for cash.
“His intent was never to help,” John Gibbs, a federal prosecutor, said Thursday. “His intent was to lie.”
At the time he was recruited, prosecutors say, Mr. Mallory was thousands of dollars in debt and behind on his mortgage, making him a prime target for intelligence operatives looking to trade money for secrets. In Mr. Mallory’s case, the Chinese gave him $25,000, the authorities said.
Mr. Mallory is scheduled to be sentenced in September.
The high-profile case is among several recent ones involving Chinese attempts to recruit former American intelligence officials. In January, the F.B.I. arrested Jerry Chun Shing Lee, another former C.I.A. officer, who had repeated contacts with Chinese intelligence. He has been charged with illegally possessing classified information and conspiring to spy for the Chinese.
Last week, prosecutors charged Ron Rockwell Hansen, a former Defense Intelligence Agency case officer, with attempted espionage. The F.B.I. began investigating Mr. Hansen’s activities in 2014.