The horrific murders in northern Mexico this week by drug-cartel gunmen are a stark reminder that the United States and our southern neighbor still face significant security challenges. Yet the violence overshadows a policy success story on border security: the Trump administration’s effort to curb the flow of would-be migrants at the border, preventing our border-security infrastructure from being totally overwhelmed and cutting down on opportunities for human rights abuses of migrants and human trafficking by criminal gangs.

The reason you don’t see breathless hyperbole about “children in cages” dominating news cycles anymore is because between May and August, border officials report a sharp decrease in migrants attempting to cross the US border, with apprehensions falling by 62% and total enforcement actions dropping by 70%.

In September, there were some 40,000 arrests, the lowest month this fiscal year and down from nearly 133,000 apprehensions in May.

The reason? Determination and sustained pressure by the Trump administration — including, yes, threats of tariffs — to convince the government of Mexican President Andrés Manuel López Obrador to do its part to stop the flow of migrants, mostly from Central America traversing Mexican territory.

Last June, to avoid the prospect of tariffs on Mexican automobiles, López Obredor agreed to boost immigration enforcement and allow more migrants to await their US immigration proceedings in Mexico.

To crack down on the migrant routes, Mexico agreed to send a newly created National Guard to its borders and to dismantle human smuggling networks. Thousands of troops are deployed to Mexico’s northern border, where they’ve established 20 checkpoints. On the southern border with Guatemala, 12,000 troops are deployed, with 21 checkpoints.

Moreover, military helicopters have been deployed on both borders for aerial surveillance.

President Trump has expressed his gratitude for the Mexican response. In his speech in September at the UN General Assembly, he said, “I would like to thank President López Obrador of Mexico for the great cooperation we are receiving, and for right now putting 27,000 troops on our southern border. Mexico is showing us great respect, and I respect them in return.”

Naturally, not all are happy with what the Mexican government is doing. Media personality and open-borders advocate Jorge Ramos, in a recent New York Times op-ed, wrote, “President Trump is using Mexico. And, against all logic, Mexico is letting him get away with it. This has to change.”

But López Obrador doesn’t deserve Ramos’ scorn. The Mexican president evidently understands what Ramos does not. Given the deep, integrated ties between the Mexican and United States economies, Mexico cannot simply afford a contentious relationship with any American president.

In a recent press conference, López Obrador defended his position, “We represent our country with dignity, and we have nothing to be ashamed of. The sovereignty of Mexico is defended. At the same time, we do not want confrontation … We are especially interested in a good relationship with the United States.”

It doesn’t hurt that he has on his side a sizable body of public opinion. Polls show that many Mexicans are tired of being a waystation for increased migration through the country, seeing it as a drain on Mexico’s economy and services.

It’s not surprising that Trump’s critics remain unmollified. They wanted the border infrastructure to buckle under the weight of the migration onslaught and overwhelm immigration courts, resulting in tens of thousands of migrants entering the US with scant oversight. But the Trump administration held firm and was able to defuse the crisis.

As the recent murders of US citizens indicates, major challenges remain in the US-Mexico partnership, including drug cartels distributing tons of cocaine, marijuana, methamphetamine and heroin in the United States. Migratory pressures also need to be addressed by a regional development plan to address the root causes of migration in Mexico, El Salvador, Guatemala and Honduras.

Finally, the White House cannot carry the burden alone. Congress needs to revamp an immigration system that is failing to meet the needs of the United States in the 21st century. Only by solving the challenges on our border, as opposed to simply trying to manage them, can we deliver the security and prosperity both nations deserve.

José Cárdenas served in the George W. Bush administration, focusing on Latin America and the Caribbean.