I was in Mexico Thursday seeing the Mexican president, foreign minister and finance minister and addressing a convention of bankers. The only subjects anyone is interested is the future of NAFTA and U.S. Mexican relations.

I came to Mexico from Beijing, and so I was able to report that there was no greater strategic gift the United States could give China than to abrogate NAFTA and rupture the North American community.

In narrow commercial terms right now, Mexican goods enter the United States on a preferred basis relative to Asian goods. This preference would disappear with NAFTA suspension. Furthermore about 70 percent of Mexican exports are of goods that are not finished but are inputs to further U.S. production. Anything that hurts Mexico therefore hurts us in global economic competition with China.

There is a further, even more important, strategic dimension. As illustrated by the more than $60 billion China has poured into Hugo Chávez’s Venezuela, China would regard opportunities to ally with a hard-left anti-American government as strategic windfalls. What better than a country of 130 million people with a 2,000 mile border with the United States? Every Mexican with whom I spoke said that the risk of Mexico electing a Chávezlike government had gone way up in recent months on account of American disrespect and truculence.

China apart, NAFTA strengthens the U.S. economy. U.S. tariffs without NAFTA would average less than 3 percent, so repeal would not greatly reduce protection. Indeed by undermining the peso, U.S. challenges to NAFTA have led to an effective 10 to 15 percent subsidy on all Mexican goods. There is the further point that the United States competes more effectively globally with access to low-cost Mexican inputs. More than two-thirds of our imports from Mexico are inputs to further U.S. processing.

There is a silver lining in all the fuss over NAFTA — it needs updating. Digital trade didn’t exist in 1993. Thinking has shifted on the need to assure that trade agreements are in worker interests. This means more emphasis on labor standards and more need to ensure that dispute settlement systems do not overly empower corporate interests. Most important, with more competition from Asia and with the increased sophistication of the Mexican economy, there is a strong case for strengthened rules of origin that enhance North American manufacturing.

Changes along these lines may have an “America first” aspect but they are also in Mexico’s interest. They are the right way forward.

It is also essential that the United States and Mexico find a way forward on immigration. A wall is a 19th-century response to a 21st-century concern. I’m told that most illegal immigration does not take place through people crossing open borders in the desert — the only thing a wall could address. Rather it takes place through illegal entry at legal checkpoints as people are smuggled in in freight containers and the like. This will be unaffected by a wall. Technology, data science, enhanced collaboration, and cooperation with respect to Central America are much better ways to resist illegal immigration flows. They are also much more likely to strengthen our alliance with our most populous neighbor.