The weekend’s protests in Mexico City were a reminder that President Trump’s proposed “physical wall on the southern border” has two sides, not one.

In late January, Trump’s executive order on border security called for the construction of the wall, along with increased border patrol activities to control immigration.

The order requests a full review of all “direct or indirect Federal aid or assistance” to Mexico over the past five years — and Trump claimed in a Jan. 25 ABC interview that “we will be in a form reimbursed by Mexico.”

Here’s what’s missing: There’s no mention of cooperating with Mexico to achieve the order’s stated objectives. This executive order, and comments and tweets from the Oval Office, obscure the fact that Mexico is an ally, not an adversary, in border security efforts.

Homeland Security Secretary John F. Kelly understands this point. In his confirmation hearing, Kelly asserted that partnerships with countries “as far south as Peru” were more important to U.S. border security than walls. As the former head of the U.S. Southern Command, Kelly has seen firsthand the power of bilateral partnerships.

There’s a long history of cooperation with Mexico

Developing a U.S.-Mexican border control partnership has been a long and tenuous process. Given our shared history and the power imbalance between the countries, Mexico has always been cautious about protecting its sovereignty and is sensitive about engaging with the United States on migration issues.

Migration relations with Mexico have been tense historically. For a long time, Mexican leaders preferred to “delink” migration from foreign policy, both out of respect for U.S. sovereignty and because of a constitutional commitment to a “right to exit.”

Since the 1990s, closer economic integration through the North American Free Trade Agreement helped prompt the Mexican government to take a greater role in shared border control issues. The two countries expanded their cooperation on counternarcotics, but cooperation on migration was always more sensitive.

It was only with the election of President Vicente Fox in 2000 that Mexican foreign policy shifted toward a more engaged approach on migration. Fox promoted a comprehensive migration accord and accepted a “shared responsibility” with the United States for migration control.

There’s been a high level of cross-border cooperation since 9/11

After 9/11, Mexico and Canada immediately stepped up cooperation on border control and counterterrorism. Both countries quickly signed agreements to develop “smart borders,” with the goal of facilitating trade and travel while simultaneously enhancing cross-border security. Mexico committed to a 22-point plan for cross-border cooperation “at the local, state and federal levels,” including information sharing, smuggling deterrence mechanisms, a law enforcement liaison program and many other measures.

The country also began counterterrorism operations, detaining and questioning Middle Eastern migrants, and reportedly even infiltrating smuggling networks to identify non-Spanish-speaking migrants who might pose terrorism threats to the United States.

The U.S.-Mexico border partnership is effective on many levels

The two countries have signed 53 treaties that deal with law enforcement cooperation alone. The earliest U.S.-Mexico counternarcotics agreement still in force dates back to 1930.

Since the 2006 Mérida Initiative, which cracked down on drug smuggling and money laundering, cooperative efforts enabled the capture of major drug kingpins such as Joaquín “El Chapo” Guzmán.

The 2010 “21st century border” initiative facilitates the flow of trade while blocking illicit flows, and sets up joint pre-inspection points for cross-border traffic.

The bilateral partnership has been effective. In 2014, U.S. and Mexican authorities worked to stem the flow of unaccompanied Central American minors entering the United States illegally. The number of entrants fell again in 2015 and 2016.

One significant reason for this decline was increased Mexican enforcement — along the country’s other border. Mexican interdictions of unaccompanied children from El Salvador, Guatemala and Honduras increased by 6,638 between fiscal 2014 and fiscal 2015. In the same period, U.S. interdictions fell by 23,318. In other words, nearly 30 percent of the U.S. decline reflects Mexican interdictions.

Peter Andreas described the U.S. efforts to deter irregular migration in the 1990s as a “politically successful policy failure.” They helped U.S. policymakers look like they were doing something about the illegal immigration problem, but didn’t reduce irregular migration.

Studies show that in response to U.S. deterrence efforts in this period, migrants simply shifted their routes — they were diverted, but not deterred. The main effects of the escalation of U.S. deterrence policies were to increase the rates that human smugglers charged, as well as increase the net number of irregular migrants staying in the United States permanently rather than migrating seasonally. They also led to countless deaths at the border.

By contrast, border control efforts in the late 1990s and early 2000s seem to have been more effective. It is hard to empirically separate the effects of increased U.S. unilateral efforts from the impacts of the numerous U.S. border security partnerships developed since 9/11. But the importance of bilateral cooperation is suggested by evidence that border walls are more effective when guarded from both sides.

There’s little scope for cooperation in this executive order

Trump’s negative portrayal of Mexican migrants and his promises to make Mexico pay for a wall put Mexican President Enrique Peña Nieto in an impossible position. The Mexican president has been decidedly pragmatic in his approach to relations with Trump, sacrificing domestic support in the interest of building a strong relationship.

But the issue of the border wall may push the bilateral relationship to a breaking point. Even if Peña Nieto remains constructively engaged, this episode has empowered candidates for the 2018 Mexican elections who are likely to be much less accommodating.

Ideally, Trump would look to reframe this discussion and tap into areas of overlapping interest between the two countries. Mexico was an early signatory to the U.N. Palermo protocols against human smuggling and trafficking, and has long worked on migration management with U.S. authorities, along with cooperation on counterterrorism and counternarcotics initiatives.

An uncooperative — and antagonistic — border relationship would be counterproductive to all of these efforts. Elsewhere in the world, some countries of origin and transit have leveraged their ability to control migration to pressure much more powerful receiving states to do their bidding.

Mexico has always refrained from these tactics. But the country is not unaware of the role that it plays in keeping America safe, as evidenced by former Foreign Secretary Jorge Castañeda’s threat to roll back cooperation if Trump rolls back NAFTA: “Let’s see if his wall keeps the terrorists out, because we won’t.”

Kate H. Tennis is a PhD candidate at American University. She writes about border security, irregular migration and transnational security cooperation.