Former CIA officer Kevin Mallory was sentenced to 20 years in prison Friday.

Mallory, 62, was convicted last year of providing his Chinese handlers with classified information in exchange for $25,000.

Kevin Mallory (Alexandria Sheriff’s Office via AP)

The Virginia man, a fluent Mandarin Chinese speaker, spent two decades working in U.S. intelligence, first as a covert case officer for the CIA and later as an intelligence officer for the Defense Intelligence Agency.

He then worked as a CIA contractor until 2012, but lost his top secret security clearance after he improperly disclosed classified information, according to court records. Since 2012, he ran his own consulting firm, and was struggling financially when he was contacted on business networking service LinkedIn in 2017 by a Chinese intelligence officer who claimed to be a think tank representative.

Mallory responded to the LinkedIn message and traveled twice to China, where his handlers gave him a Samsung phone that doubled as a covert communications device.

According to prosecutors, Mallory gave the Chinese documents of a classified spying operation and a CIA analysis of a foreign country’s intelligence capabilities. He also reached out to his former colleagues at the CIA in an effort to obtain more secret information, but his former colleagues has suspicions, and the CIA and FBI began investigating Mallory.

Upon returning from his second trip to China, he was stopped by customs officers at Chicago’s O’Hare International Airport. Officers discovered the Samsung phone and thousands of dollars in cash.

Agents were able to recover texts from the phone between Mallory and his handlers.

“Your object is to gain information, and my object is to be paid for,” Mallory told Chinese intelligence.

"I will destroy all electronic records after you confirm receipt. I already destroyed the paper records. I cannot keep these around, too dangerous,” another text said.

In a search of his home, investigators also discovered eight secret and top-secret documents.

“Mallory not only put our country at great risk, but he endangered the lives of specific human assets who put their own safety at risk for our national defense,” U.S. Attorney G. Zachary Terwilliger said in a statement.

Assistant Attorney General John Demers called the case “an alarming trend” of former U.S. intelligence officers passing along government secrets to China.

Former intelligence officer for the Defense Intelligence Agency Ron Hansen, 58, pleaded guilty in March to attempted espionage. Former CIA case officer Jerry Chun Shing Lee, 54, pleaded guilty this month to spying for China.