ALEXANDRIA, Va. — A former CIA officer was convicted Friday on charges he spied for China by providing top secret information in exchange for $25,000.

Kevin Mallory, 61, of Leesburg, faces up to life in prison, although federal sentences are often less than the maximum. A sentencing hearing is scheduled for Sept. 21.

Mallory was charged under the Espionage Act last year after he was discovered with more than $16,000 in undeclared cash on a return flight from Shanghai. Prosecutors said he was desperate for cash and transmitted classified information to a Chinese handler.

His acts were far from isolated as China actively tries to gather classified U.S. information, federal prosecutors said immediately after his espionage conviction.

“The People’s Republic of China has made a sophisticated and concerted effort to steal our nation’s secrets,” Assistant Attorney General Demers said. “Today’s conviction demonstrates that we remain vigilant against this threat and hold accountable all those who put the United States at risk through espionage.”

Public defender Geremy Kamens, an attorney for Mallory, declined to comment.

Mallory’s trial at the federal courthouse in Alexandria, Virginia, offered a rare glimpse into the world of espionage. Most cases end in plea deals because the government is concerned about exposing secrets, while defendants are worried about potentially stiff sentences.

Defense lawyers said Mallory provided no information of consequence. They said he pursued legitimate work as a consultant and reported his suspicions that the Chinese were trying to solicit secrets to his old contacts at the CIA.

The spycraft, as laid out by prosecutors, was hardly reminiscent of James Bond. The Chinese gave Mallory a Samsung cellphone for covert communication that was activated with the password “password.”

The phone, with a variation of an app called WeChat, was supposed to delete text conversations Mallory had with his Chinese handler. But when Mallory gave the phone to FBI agents investigating his conduct, the phone mistakenly provided long histories of text chats.

In one text, Mallory wrote “your object is to gain information, and my object is to be paid.”

The Chinese handler responded, “my current object is to make sure your security and to try to reimburse you.”

In other texts, the Chinese handler complains that the information Mallory provides is vague. Eventually, the handler becomes concerned that his contacts with Mallory may be exposed and he tells Mallory to stop sending documents and texts.

Exactly what Mallory may have provided remains somewhat unclear. Prosecutors said they are certain Mallory used the phone to send two documents, and he may have sent more or handed off more in person during two trips to China.

The information he did provide was top secret and touched on human assets, prosecutors said.

But defense lawyers said nothing Mallory provided is the kind of sensitive information that relates to the national defense to trigger a violation of the espionage law. The bulk of it, they argued, was publicly available information.

During the trial, though, lawyers referred to the documents in generic terms, and portions of documents were redacted. Jurors were given more detailed information.

In all, prosecutors said Mallory received $25,000. By comparison, former U.S. intelligence officer Ron Hansen is facing charges in Washington state that allege Chinese intelligence paid him up to $800,000.

Mallory’s trial occurred in the U.S. court’s Eastern District of Virginia, which is home to the CIA and Pentagon and often plays host to national security and espionage cases.

The last espionage-related trial in the Alexandria came in 2009. Pentagon official James Fondren was convicted and sentenced to three years in prison for charges involving espionage and making false statements to the FBI.