(The following article is adapted from a series of talks in California given June 25-28)

Mexico has a momentous election on July 1.  Who gets elected and how U.S.-Mexico relations unfold afterwards will have major consequences for California and the United States, as well as Mexico.

The massive economic relationship with Mexico and effective border management and law enforcement collaboration are crucial for California as well as the United States.  The vibrant educational cooperation between the two countries, where California has played a crucial role, can be a key for future competitiveness of both nations as well as for mutual understanding with America’s southern neighbor.

Californians and all Americans have much to gain if that collaboration continues and deepens with Mexico’s new leaders.  Sadly, the recent U.S. rhetoric and actions taken at the border, and the state of NAFTA negotiations do not bode well as Mexicans head to the polls to choose a new president for a six-year term, as well as to elect over 3,000 other national, state, and local officials.

The elections and their aftermath provide a window of opportunity to make progress with a new NAFTA accord and to set a better tone for working with Mexico’s new leaders on vital homeland security issues including migration.  Or, they could mark a shift toward a more contentious relationship and a return to the distant relations of the 1980s.   The latter would be costly for the United States and California.

The leading Mexican presidential candidate is Andres Manuel Lopez Obrador, commonly known as AMLO, a left-of-center former mayor of Mexico City, who ran unsuccessfully for President twice before.  His campaign focuses on rooting out corruption and standing up for the common man.  AMLO has a 15 to 20% lead in most polls with his Mexico-centric, “throw the bums out” themes.  Experts say he and his allies may also win control of Congress.

AMLO is benefiting from popular anger at the last two presidents and their political parties which allowed insecurity and corruption to spread while not generating sufficient economic growth.  AMLO’s call to throw out the “mafia of power” and launch programs to help the “good people” of Mexico has resonated beyond any specific propositions from him or other candidates.  The record 25,000 violent homicides in 2017 and continuing record-setting killings fuel the drive for change.  

The Mexican campaign has concentrated on insecurity, corruption, and economic opportunity, not on the United States.  But, the sharp U.S. criticisms of Mexico’s role in NAFTA, migration, and security and recent U.S. border steps generated reproaches from all the presidential candidates, as well as the Mexican government.  The U.S. comments about Mexico are widely seen as unjust, disrespectful, and ignoring Mexico’s substantial cooperation on security and migration.  Unfavorable opinions of the United States among Mexicans have surged to well over 50% compared to 29% three years ago.  AMLO reportedly shares these views, but he has taken a moderate tone.  He has proposed cooperation to deal with the root causes of migration from Central America, for example.

What happens in and with Mexico touches more lives daily in the United States and California than ties with any other country in the world.  Some 35 million U.S. citizens are of Mexican heritage.  Over a million legal border crossings take place each day along the 1990-mile shared border as part of the $616 billion in trade. U.S.-Mexico trade has multiplied by six since the North American Free Trade Agreement (NAFTA) was negotiated 25 years ago.  The two countries trade a million dollars a minute.  Mexico is the United States’ second largest export market.   Some five million U.S. jobs are supported by trade with Mexico, compared to an estimated 700,000 in 1993.  Mexico is California’s top export market with $26.7 billion in sales, compared to $7.7 billion in 1994.  This relationship has made both countries’ economies stronger, and has helped U.S. companies compete with Asian economic powerhouses.

On May 31st, President Trump applied tariffs to steel and aluminum from Mexico, Canada, and Europe, asserting that these imports threaten U.S. national security.  Mexico and others reject the rationale and are applying tariffs in return.  This dispute will cost U.S. businesses, farmers, workers, and consumers.

The renegotiation of NAFTA was already at loggerheads. California could lose 200-400,000 jobs and $5-17 billion in exports, if NAFTA ends, as an example of what would be very high costs for the United States, according to two studies.  With deeper cross border integration, the United States could gain a lot: for example, California could gain 380,000 -780,000 jobs, a separate study finds.

The illegal cross border commerce in drugs, arms, money, and people underscores the importance of working together to manage shared security threats.  Since 2007, bilateral security cooperation on fighting drug trafficking, illegal immigration, and terrorism has deepened to unprecedented levels.  The U.S. criticisms, however, are leading Mexicans to rethink that security cooperation.

Pundits are rightly asking how AMLO will govern if he wins and discussing the massive challenges he will face to fulfill his campaign promises. No matter who wins Mexico's July 1 election, however, the way the United States treats Mexico in the months ahead will set the tone for relations during the next six years. The United States risks a much more hostile reaction with Mexico's new President and Congress if things stay on the current trajectory.

The United States should work for a "win-win" approach with Mexico's new President by bringing the NAFTA talks to a positive outcome, cementing cooperation against criminals, working together on the root causes of migration, and changing the rhetoric. California and other states with so much at stake should champion this effort.

This article was originally published on the Mexico Institute's blog on Forbes.com.