Every airplane passenger who arrives in Mexico is vetted against U.S. criminal and national security databases, a ­daily dose of intelligence sharing aimed at finding fugitives and suspected terrorists.

In the Mexico City airport, plainclothes U.S. border officers work alongside their Mexican counterparts to investigate suspicious travelers bound for the United States. In Brownsville, Tex., U.S. customs agents remotely watch X-ray scans of train cargo from the Mexican side of the border.

For much of their history, the United States and Mexico had a wary relationship and security cooperation was limited. It wasn’t until 1996 that Mexico began extraditing its citizens accused of crimes to the United States. But over the past two decades, as their economies have become more ­interdependent, the countries have developed an extraordinary level of collaboration in addressing terrorist threats and capturing dangerous criminals.

Today, that partnership is at risk. The Trump administration has threatened to ramp up deportations of illegal immigrants, scrap the North American Free Trade Agreement (NAFTA) and make Mexico pay for a border wall. The Mexican economy minister, Ildefonso Guajardo, told a Canadian newspaper last month that if relations deteriorate, “the incentives for the Mexican people to keep on cooperating” on security issues “will be diminished.”

“Many different agencies and many different players are now in a holding position,” said a senior Mexican official, who spoke on the condition of anonymity to be candid. “That is not good.”

U.S. Customs and Border Protection officer Rachel McCormick, left, and Mexican customs officer Alejandra Galindo demonstrate how they would jointly inspect a cargo truck carrying goods from Mexico into the U.S. while at the Mariposa Inspection Facility at the Nogales Port of Entry in Arizona. (Astrid Galv'n/AP)

[Trump’s taunts are stirring a level of nationalism Mexico hasn’t seen in years]

While existing programs have not stopped, the Mexican government is reviewing how security cooperation could change in the event that President Trump pushes forward with policies that harm this country, according to Mexican officials.

“Now is a moment to question our drug and migration policy” with the United States, said Gabriela Cuevas, an opposition senator who is president of the Foreign Relations Commission. “We know that the United States is important. But it seems the U.S. government doesn’t understand that Mexico is important. I think Mexico should have a Plan B.”

While Mexico relies heavily on the United States for things such as trade and investment, its contributions to its northern neighbor also are significant, especially in security. For example, under pressure from the White House, Mexico has cracked down in recent years on Central American migrants bound for the United States, deporting hundreds of thousands of them.

Cuevas said that Mexico could choose to scale back that cooperation. It could also force U.S. Drug Enforcement Administration officials “to leave our country immediately” if relations deteriorate, she said. That could hurt the fight to prevent heroin from flowing into the United States, in the midst of an addiction epidemic.

“The cooperation continues to be good, but we could lose many things,” Cuevas said.

Some law enforcement exchanges have already been postponed. The heads of Mexico’s army, Gen. Salvador Cienfuegos, and its navy, Adm. Vidal Francisco Soberón, called off a planned trip to meet Defense Secretary Jim Mattis shortly after President Enrique Peña Nieto canceled a visit to Washington in January in a dispute over the proposed border wall.

Mexicans do not want to appear to be “going out of their way to embrace the Americans at a time when people in Mexico are feeling under attack,” said Eric Olson, a Mexico expert at the Wilson Center in Washington. The Mexican military leaders later met with Secretary of State Rex Tillerson in Mexico City.

A mixed relationship

For most of the past two centuries, Mexico and the United States have had a complex, mutually suspicious relationship. The border line was established in 1848 after a war in which Mexico lost half its territory to the United States. After World War II, Mexico refused to sign a military assistance agreement with the United States even as other Latin American countries did.

But over the past two decades, as trade between Mexico and the United States boomed, law enforcement cooperation also intensified.

On the American side, the Sept. 11, 2001, attacks drove interest in securing the border. Under Mexico’s previous president, Felipe Calderón, a stepped-up offensive against drug cartels led to a closer working relationship with DEA officers and intelligence agencies.

[U.S. role at a crossroads in Mexico’s intelligence war on the cartels]

Every day, U.S. and Mexican officials are in contact about security issues such as money laundering, child pornography, human trafficking and drug running. Mexican customs agents are stationed inside the U.S. Customs and Border Protection (CBP) national targeting center for cargo in Herndon, Va., while U.S. immigration and customs officers train their Mexican counterparts on gathering biometrics, managing checkpoints and questioning U.S.-bound migrants in Tapachula, on Mexico’s southern frontier.

“It became a really quite warm and cooperative relationship,” Gil Kerlikowske, who stepped down as commissioner of CBP earlier this year, said in an interview.

Every year, a couple hundred criminals and fugitives fleeing the United States are captured in Mexico and turned over to U.S. authorities. Last year, Mexico extradited 79 peopleto the United States, compared with 12 in 2000. Just before President Barack Obama left office, the U.S. government got the top criminal prize from Mexico, when the country sent drug lord Joaquín “El Chapo” Guzmán to face an American court.

In recent years, Mexican authorities have given U.S. authorities access to suspicious travelers from Syria, Iraq, Somalia, Libya and elsewhere.

Mexico also has detained and sent home hundreds of thousands of Central American migrants. If that cooperation were not in place, “it would have a dramatic impact on the flow of migrants to the southwest border” of the United States, said Alan Bersin, who served as a top Department of Homeland Security official in the Obama administration.

“Were the United States to continue along the lines of the president’s grossly insulting tone and substance,” Bersin said, referring to Trump, “or if there were an attempt to redraw fundamentally the economic framework that has grown trade from $80 billion annually to nearly $700 billion, there’s no reason the United States should expect Mexico to continue the cooperation we’ve received on security.”

Much in the relationship depends on whether the Trump administration pursues trade policies that harm Mexico, which sends most of its exports to the United States. Trump has argued that NAFTA was not a good deal for American workers and should be renegotiated.

Some former U.S. officials worry that, if bilateral ties worsen, Mexico might cut back on extraditing drug suspects and stop helping on issues such as fighting poppy cultivation. More than 90 percent of U.S. heroin comes from Mexico. The Obama White House was in “pretty advanced conversations” with Mexico on plans to increase cooperation on eradicating poppy plants and helping farmers to cultivate alternative crops, said Mark Feierstein, the former senior director for Latin America on the National Security Council.

“That’s a concern now,” he said. “We do need Mexico’s cooperation on it. Mexico has the option of saying, ‘Not our problem. You’re the consuming country.’ ”

Gabriela Martinez contributed to this report.

Read more

A Mexican populist rises to face Trump’s America

Trump policies strain the ties that bind a Mexican village to small-town Illinois

U.S. border officials are illegally turning away asylum seekers, critics say

Today’s coverage from Post correspondents around the world

Like Washington Post World on Facebook and stay updated on foreign news