Over the Easter weekend, news broke about a caravan of Central American migrants heading for the U.S. Led by Pueblo Sin Fronteras, the group of over 1,000 migrants was planning to enter the U.S. illegally. Some were also planning to illegally stay in Mexico.

Before the problem even reached our borders, the Mexican government resolved it. According to Secretary of Homeland Security Kirstjen Nielsen, Mexican authorities are vetting the migrants and sending back those who do not qualify for refugee status in Mexico.

This caravan saga should reinforce two important facts: (1) the U.S.-Mexico relationship is strong under President Donald Trump, and (2) Mexico is an invaluable partner for U.S. national security.

Within less than 48 hours, a potentially destabilizing situation for both countries was quickly de-escalated. This serves to highlight the depth of cooperation between the Trump administration and the Mexican government. It reiterates Mexican Foreign Minister Luis Videgaray’s characterization of the U.S.-Mexico relationship: “It’s closer than it was with previous administrations, which might be surprising to some people but that’s a fact of life.”

Since the early days of the Trump administration, the U.S. has expanded cooperation with Mexico on regional and global issues. Both countries are impacted by the challenges in the Northern Triangle of Central America and are seeking joint approaches toward the region.

Aside from joint initiatives pursued with the U.S., Mexico is conducting its own efforts to confront security challenges like illegal migration. In the first two months of 2018 alone, Mexico deported over 16,000 illegal immigrants—15,835 of whom were from Central America.

Mexico has also ramped up efforts to secure its 600-mile border with Guatemala. Just last week, the U.S. and Mexico signed three agreements aimed at combatting illicit activities in both countries, and there are reportedly more than two dozen other agreements in the pipeline.

Critics of the Trump administration’s decision to block the 1,000-plus migrants ignore a few harsh realities.

For starters, it would be unjust for illegal immigrants to gain priority over asylum applicants and others who actually followed the law. In addition, loopholes in U.S. immigration law would have continued incentivizing mass waves of illegal immigration. This would have set a dangerous precedent for both the U.S. and Mexico where organizations with a political agenda, like Pueblo Sin Fronteras, would continue using vulnerable people as pawns.

Leaders of the migrant caravan claim falsely that Trump’s policies toward Central America have worsened security conditions in the region. They point to his support of the re-election of Honduran President Juan Orlando Hernandez and the violence in Honduras following his narrow win.

While there are ongoing concerns about Honduras’ need for electoral reform, the election results reflected the will of the people. Still, Honduras must do a better job at providing safety and security for its people.

No one should be shocked at Trump’s proposal to deploy U.S. troops to the border, either. There is nothing new or unprecedented about this. Both Presidents George W. Bush and Barack Obama sent National Guardsmen to support Customs and Border Protection officers.

On the other side of the border, the Mexican army and marines routinely patrol violent border towns like Nuevo Laredo, Reynosa, and Tijuana.

Honduras is not alone in needing to address the driving factors of illegal immigration. Their Northern Triangle neighbors (El Salvador and Guatemala) must continue their efforts to ensure security and prosperity for their respective populations. The lack of effective governance in these countries is a tragedy and should receive far more attention.

Thanks to Mexico’s intervention this week, the U.S. averted a potential crisis. In the future, though, we might not be as lucky. Congress should use this opportunity to close the loopholes that incentivize illegal immigration. Gaps in border security must be addressed, and catch-and-release policies must be terminated.

Congress should be mindful that the challenges driving illegal immigration begin further south of the border. Continued cooperation with Mexico and other partner nations in the region is the best path forward.