Federal prosecutors in Chicago spent hours Thursday trying to paint a once high-ranking Mexican cop as a traitor who maintained secret ties to one of the world’s most wanted drug traffickers and leaked key U.S. intelligence to another cartel.

They hoped to put Ivan Reyes Arzate, 46, behind bars for a decade. Having once trained at the DEA’s academy in Quantico, Va., Reyes would go on to jeopardize the lives of DEA agents and do serious damage to an ongoing investigation in Mexico.

But at the end of the lengthy sentencing hearing that featured testimony from a key lieutenant to late drug kingpin Arturo Beltran Leyva, U.S. District Judge Harry Leinenweber instead gave Reyes 40 months in prison. Because he has already been behind bars since spring 2017, Reyes will likely go free in a little over a year.

A former Chicago cop, Ronald Coleman, received a heftier five-year sentence just last December for tipping off a street gang to a pending raid.

Leinenweber handed down Reyes’ sentence after hearing emotional testimony from one of the agents Reyes betrayed, and after listening to Reyes accuse prosecutors of making claims “full of contradictions, based on assumptions and false statements.”

Multiple references were made to the trial of Joaquin “El Chapo” Guzman, Beltran Leyva’s rival, now getting underway in Brooklyn. Beltran Leyva was killed in a standoff with Mexican authorities in Cuernavaca late in 2009.

Reyes once served as the highest-ranking member of the Mexican Federal Police’s sensitive investigative unit. That meant highly sensitive U.S. intelligence shared with Mexico would often flow through him.

Authorities became suspicious when information collected by wiretap began to match the information shared with Reyes. The leader of a key drug cartel, Angel Dominguez Ramirez Jr., also explicitly referred to “Ivan” in a conversation with an associate.

“Who is Ivan?” Dominguez asked.

“The boss,” he was told.

To drive home their point, prosecutors hauled into Leinenweber’s courtroom Sergio Villarreal Barragan, a towering former Mexican cop and Beltran Leyva associate known as “El Grande.” He wore a prison jumpsuit with black-and-white stripes as he admitted watching his close friend, Beltran Leyva, murder and torture.

Villarreal is serving his own 10-year prison sentence.

Villarreal described a meeting near Cuernavaca called by Beltran Leyva after authorities began seizing speed boats he used to move drugs. Beltran Leyva suspected he had a leak. Villarreal said multiple Mexican cops attended, including one he knew as “La Reina” — a nickname the feds say Reyes later acknowledged.

Villarreal said “La Reina” handed a cardboard binder filled with information about the leak to one of the higher-ranking officers. He said that officer gave it to Beltran Leyva, who recognized the person in a photograph it contained.

“(Beltran Leyva) became very angry,” Villarreal said through an interpreter, “and ordered that he be kidnapped.”

That person, a DEA informant, was also tortured and killed.

DEA Special Agent Matthew Sandberg followed Villarreal to the stand and told the judge Reyes did immense damage to the United States’ relationship with Mexican law enforcement and “set us back incredibly.”

Then, Sandberg began to choke up as he told the judge about the officers from the United States and Mexico whose lives have already been lost to the drug war.

“It only takes one or two to put everyone in jeopardy,” he said.