This is why Mexico today faces a tough choice, given the asymmetry between both countries: accommodate Mr. Trump and get the least-bad deal possible, or lay out a series of red lines or list of American demands Mexico cannot accept and adopt a policy of forceful resistance. It could then attempt to wait Mr. Trump out, hoping that he will open too many fronts simultaneously, that domestic opposition to his excesses will grow, and that Mexico’s allies in the United States and abroad will eventually rebalance the unequal correlation of forces.

Mr. Peña Nieto had no choice but to cancel his trip. But he had partly boxed himself into a corner because of previous indecision or procrastination.

He knew some time ago that Mr. Trump would insist on renegotiation. He knew that several roads could lead to a favorable outcome for all three member countries, but that there could also be dire consequences for Mexico if the road chosen led to a revised Nafta requiring drawn-out deliberations in the legislative bodies of Canada, the United States and Mexico. The agreement would then fall hostage to partisan bickering, with no guarantees of approval. The uncertainty that would entail might easily place new foreign investment in Mexico on hold.

Mexico should have a red line on trade. Everything that can be done without new legislative approval in all the three countries is fair game, but nothing else. Better to have the United States invoke Nafta’s Article 2205, which says that a country can withdraw from the agreement six months after giving notice.

A similar red line should have been drawn by Mr. Peña Nieto on the prickliest, if not the most substantive issue: the wall. Again, incomprehensibly, Mr. Peña Nieto painted himself into a corner by stressing the wall’s payment, rather than its very existence. The crux of the matter should never have been who would pay for it, but rather that it was an unfriendly act toward a friendly country, sending a disastrous symbolic message to Latin America. The real issue is that it will generate countless social, cultural and environmental problems along the border; raise the cost and danger of unauthorized crossings; and attract even more organized crime.