MEXICO CITY — Even in a nation almost inured to corruption, the news was astonishing.

The man considered to be the brains behind the Mexican government’s militarized war on drug traffickers stood accused by American prosecutors of having been in the pocket of one of the major criminal groups he was ostensibly pursuing, severely undermining the very fight he was helping to lead.

Genaro García Luna, Mexico’s former public security secretary, was charged with taking millions of dollars in bribes while in office to protect the Sinaloa Cartel, allowing the organization to smuggle tons of cocaine and other drugs into the United States. At the time, the group was led by Joaquín Guzmán Loera, better known as El Chapo, who is now serving a life sentence in the United States.

The indictment, unsealed in New York on Tuesday, and the subsequent arrest of Mr. García Luna in Dallas hours later, stunned Mexico. It was as if Eliot Ness had actually been an accomplice of Al Capone.

“It’s huge,” said Jaime López-Aranda, a security analyst in Mexico City who briefly worked under Mr. García Luna in the late-2000s. “I’m still a little bit in shock. And I keep thinking back to the guy and our conversations and his team and his people. It’s the sharp disappointment. I mean — my God, man. It’s like — ” He paused. “It’s like the end of an era.”