MEXICO CITY — When the Andrea Gail left the port of Gloucester for a final, desperate fishing trip of the season, its captain and crew hardly imagined they would run into the "perfect storm." But everything that could go wrong combined to produce a calamity. Something similar may be brewing in U.S.-Mexican relations: perhaps nobody is looking for it or wants it but little by little, there are converging elements that may if not addressed, yield a showdown. It would be the type of confrontation not seen over three decades, and which people had come to rule out.

For almost a century, relations between the neighbors oscillated between violence and distant hostility. The U.S. invasion of 1846 shook Mexico to the core, provoking a nationalist reaction certain historians even consider it the birth pang of the Mexican identity. The two nations had their ups and downs in the revolutionary period of the early 20th century, with crises following threats to not recognize new Mexican presidents, and everything that implied. Post-revolutionary governments kept a distant relationship with the United States while promoting national unity, and using past territorial losses (to the U.S.) as the unifying tool. It was all possible because the country was inward-looking and any foreign ties were essentially symbolic.

Relations oscillated between violence and distant hostility.

The financial crises of the 1970s and 1980s forced Mexico to reconsider its economic policies, which led to a redefinition of ties with the United States. It began exporting more and more to the U.S. market, which also created disputes ranging from charges of dumping to boycotting tuna. For the first time since its independence in the early 19th century, Mexico began to see its northern neighbor as a potential solution to economic problems. Likewise the United States had problems that could be resolved with the Mexican government's cooperation. As bilateral interaction increased, and problems multiplied, both old and new — from President Richard Nixon closing the border to the death of DEA agent Enrique Camarena. Both nations finally recognized the need to establish mechanisms to ensure a functional relationship.

Memorial to the Mexican soldiers fallen in the 1847 Battle of Chapultepec — Photo: Ricardo Stuckert/PR

In the late 1980s, Presidents George H. W. Bush and Carlos Salinas de Gortari agreed on a set of principles, both explicit and implicit, to ensure good working relations and resolve or at least manage problems inherent in such a vast, complex and unequal relationship. At its heart was the crucial principle of isolating problems and dealing with each separately, to assure a basic, daily working relationship.

Mixing unrelated matters (like drugs and trade) produced constant crises and frayed nerves. Compartmentalizing them however meant giving each the attention it deserved, and a commitment not to infect the domestic arena with highly sensitive issues, like migration for the U.S or arms smuggling for Mexico. This was intended to safeguard the smooth flow of other, more natural aspects of the relationship, like trade across the border. This was the 1988 Houston agreement that boosted bilateral ties and led to NAFTA. Successive governments on both sides have since stuck to its principles, and recognized that mixing issues could threaten pragmatic working relations.

That is until now, when President Donald Trump has tied trade to migration and is raising doubts about this relationship. It is no longer about launching into diatribes against Mexico and Mexicans. The administration is threatening the principal engine of the Mexican economy (exports) by blackmailing the López Obrador government over an issue, migration, that is of particular concern to its support base and may closely affect its legitimacy.

Trump has tied trade to migration and is raising doubts about the U.S.-Mexican relationship.

The Mexican government has so far responded in two ways: Announcing on the one hand a review of the security cooperation model (Mérida Plan) and on the other, grudgingly accepting the terms of Trump's demands over Central American migration. These are contradictory and sooner or later, sparks will fly.

[There has been further tensions following Saturday's mass shooting in El Paso, Texas. Authorities say the gunman was targeting Latinos, and seven Mexican citizens were among the 22 dead in the border city. The Mexican government has responded by saying it would pursue terrorism charges in the US legal system over the shooting]

The debate inside the United States has so far ignored the benefits to the country of the Mexican government's cooperation in different fields, which was part of the incentive for the agreement reached in Houston 30 years ago. The danger now is that the U.S. administration's conduct will push the Mexicans away, back to a policy of estrangement and end up destroying all the things that have worked so well for decades, to the benefit of both sides.

See more from Opinion / Analysis here