MEXICO CITY — U.S. officials have detained a former top official who oversaw Mexico’s anti-narcotics strategy, charging that he raked in tens of millions of dollars in bribes while he enabled the country’s most notorious drug lord — Joaquín “El Chapo” Guzmán — to traffic cocaine.

The arrest of Genaro García Luna was stunning news even in a country that has struggled with profound drug corruption for years. He had been secretary of public security from 2006 to 2012, responsible for creating a new federal police force. He worked closely with U.S. officials on a multibillion-dollar effort known as the Merida Initiative to confront the cartels.

“This is the highest-ranking [Mexican] official that’s been arrested probably in at least over half a century” on drug-related charges, said Mike Vigil, the former head of international operations for the U.S. Drug Enforcement Administration.

García Luna’s detention in Dallas raised questions about whether the U.S. government had for years failed to detect the corruption of a man seen as a top ally. It also may further discredit the “war on drugs” launched by President Felipe Calderón — an aggressive American-backed plan to confront cartels. The strategy contributed to soaring levels of violence.

“There’s just a huge question mark about what was this all about, the building of the federal police, the enormous investment by Mexico and the United States and other nations” on the anti-drug effort, said Ana Maria Salazar, a security expert who formerly worked for the Clinton administration on anti-drug policy.

Calderón, who finished his presidential term in 2012, said in a tweet that he didn’t know the details of the case, but that “my position will always be in favor of justice and the law.”

García Luna’s attorney, Rose Romero, did not immediately respond to requests for comment. The former Mexican official did not enter a plea at his initial appearance before a judge in Texas on Tuesday.

But last year, he vehemently denied allegations that surfaced in a trial that he had taken money from traffickers.

“I never had any contact with, nor received people linked to, criminal activity,” he said in a publicly released letter in November 2018.

He added that, while serving as a public official, “I have systematically been defamed as long as I have attacked the interests of organized crime, and they have never produced a single piece of evidence to back up these calumnies.”

García Luna is a former intelligence agent who ran the Federal Investigation Agency, similar to the FBI, from 2001 to 2005. The U.S. Justice Department said Tuesday that García Luna began receiving payoffs from the Sinaloa cartel while at the agency, and continued doing so during his time as a cabinet minister.

“In exchange for multimillion-dollar bribes, he permitted that Cartel—one of the largest and most violent criminal organizations in the world—to operate with impunity in Mexico,” according to a detention letter filed by prosecutors from the U.S. Attorney’s Office for the Eastern District of New York to the judge overseeing the case.

Prosecutors said García Luna provided safe passage for cartel drug shipments and leaked sensitive information to the Sinaloa traffickers about investigations into the cartel and its rivals.

Allegations of García Luna’s corruption emerged in the trial of Guzmán in federal court in Brooklyn, which ended in February with a conviction on drug trafficking, murder and other counts. The Sinaloa chief was sentenced to life in prison.

“El Rey” Zambada, one of Guzmán’s former deputies who is the brother of current Sinaloa cartel boss “El Mayo” Zambada, testified that he and his sibling gave “multimillion-dollar bribes” to García Luna “to facilitate the Sinaloa Cartel’s drug trafficking operations,” court papers say.

Zambada said he “personally brought [García Luna] briefcases” containing between $3 million and $5 million, according to court documents.

Vigil, the former DEA official, said he was “shocked” by the arrest of García Luna, whom he had known for decades. “We had a great working relationship with him. We never saw any compromise of any investigation or operation,” he said.

During García Luna’s years overseeing public security, the Mexican government focused its anti-drug efforts on the Zetas, a major rival of the Sinaloa cartel that was largely dismantled. Some questioned whether authorities were quietly helping the Sinaloa gang, but the government said it was prioritizing the fight against a hyper-violent group.

García Luna moved to Miami in 2012. The indictment unsealed on Tuesday charges him with three counts of cocaine trafficking conspiracy and one of making false statements on his 2018 application for U.S. citizenship. If convicted of the drug charges, he could face a prison term of 10 years to life, the Justice Department said.

Jacobs reported from New York. Gabriela Martinez in Mexico City contributed to this report.