MEXICO CITY — The Mexican Congress passed a law Tuesday that is expected to sharply limit cooperation with the United States in the fight against illicit drugs, as outrage over the detention of Mexico's former defense minister escalated into a bilateral crisis just weeks before President-elect Joe Biden takes office.

The Chamber of Deputies voted 329 to 98 in favor of the measure, which had been approved by the Senate. The legislation was promoted by President Andrés Manuel López Obrador, who is expected to sign it.

The measure has generated alarm in the U.S. government. It would require any Mexican federal, state or local official to get permission from a high-level security panel before meeting with “foreign agents” and to send a report to the Foreign and Public Security ministries on what was discussed. That would probably choke off the sharing of sensitive law enforcement information because it would be distributed widely and run a high risk of being compromised, according to current and former U.S. officials.

The legislation appeared to mark the most significant flash point in bilateral relations since President Trump threatened in May 2019 to impose tariffs on Mexico unless it halted the passage of Central American asylum seekers to the U.S. border. At that point, Mexico backed down, agreeing to dramatically increase its immigration enforcement.

In contrast, Trump has been silent during the current standoff. Last week, Attorney General William P. Barr denounced the Mexican measure, saying it “can only benefit the violent transnational criminal organizations” the two countries are fighting. Barr has since announced that he’s leaving office, contributing to a void in U.S. leadership at a crucial moment in relations with Mexico.

There was no immediate answer to a request for reaction from the U.S. Embassy in Mexico. The Drug Enforcement Administration declined to comment on the law.

The debate in Mexico’s Congress on Tuesday reflected the outrage that has erupted among the country’s governing party and its allies over the Oct. 15 arrest in Los Angeles of Gen. Salvador Cienfuegos Zepeda on drug-trafficking allegations. The investigation by the DEA enraged the powerful Mexican military and raised concerns that U.S. agents could be tapping the phones of senior members of Mexico’s government. (U.S. officials said the intercepts of Cienfuegos’s BlackBerry were actually conducted in the United States as part of a drug case).

As López Obrador’s government threatened to curb cooperation, the Justice Department dropped the charges and sent Cienfuegos home to Mexico.

But the matter wasn’t over. Lawmakers from López Obrador’s leftist Morena party railed against the fact that the Mexican government had never been informed of any investigation into Cienfuegos, who served as defense minister from 2012 to 2018. (He says he’s innocent of the drug allegations.)

“We don’t have to subordinate ourselves to the decisions of any other country, as prior governments did,” said Mexican congresswoman Dolores Padierna, a prominent member of Morena, which holds a majority in Congress. She assailed the major U.S. efforts to help Mexico fight drug-trafficking in recent years — including the Mérida Initiative, which has provided $3 billion for equipment and training.

Opposition deputies protested that the “foreign agent” measure had been rushed through the legislature. And several noted that U.S. intelligence had been crucial in the arrests of major kingpins in recent years, including Joaquín “El Chapo” Guzmán, the former leader of the Sinaloa cartel.

“You can’t propose unilateral solutions” to combating international drug-trafficking, said Adriana Dávila Fernández of the conservative National Action Party. “Mexico can’t isolate itself; it’s not an island.”

Several deputies voiced long-standing grievances against the DEA, blaming it for punitive measures against Mexico taken in the wake of the 1985 killing of U.S. agent Enrique “Kiki” Camarena by druglords allegedly working with corrupt Mexican officials.

The new measure could affect scores of U.S. law enforcement agents based in Mexico — including from the DEA and FBI — and slow cooperation on crimes including kidnapping, money-laundering and murder, officials say. It’s not clear whether the U.S. government would withdraw any agents from Mexico in response to the law.

The legislation passed shortly after López Obrador recognized Biden as the winner of the U.S. presidential election. The Mexican president, who had developed a warm relationship with Trump, was among the last world leaders to congratulate the Democrat.