As trade ministers from Mexico, Canada, and the United States sprint to forge an agreement on NAFTA, the case of Texas reminds us of what the United States has at stake.   The “Lone Star State” will lose enormously if the North American Free Trade Agreement ends, and it will gain significantly if an updated NAFTA is agreed upon.

The contentious negotiations are endangering Texas’ and America’s massive trade with Mexico and Canada.  Unless all three governments craft compromises now, the valuable “modernization” of NAFTA will be delayed until well after a new Mexican government takes office in December.  That would leave great uncertainty for farmers, ranchers, workers, and businesses from Texas and across the United States.  Texans should be leading the charge of American states for reaching an agreement this spring.

Simultaneously, the United States must deepen cooperation with Mexico on homeland security issues.  Over the past seven years, the United States and Mexico have significantly improved cooperation on managing the border, fighting drug trafficking, and identifying potential threats before they reach the United States.  The United States and Texas need this “perimeter defense” extending far beyond America’s borders.

There is much to do to make that security cooperation more effective.  However, the recent critical tweets and remarks by President Trump about Mexico and his decision to send troops to the border united Mexico’s presidential candidates in criticism of the United States, sparked Mexico’s Senate to call for suspending U.S.-Mexico homeland security cooperation, and generated a tough speech by Mexican President Peña Nieto calling the two countries to work together on challenges and opportunities without threats.  Peña subsequently ordered a review of all cooperation with the United States.  This clash comes in the heat of Mexico’s presidential and congressional campaigns, so the potential for fanning anti-American sentiment is great.  Recent polls already show between 56 and 65 percent of Mexicans hold unfavorable views of the United States.

The longer-term costs of such clashes will be very high if a more anti-U.S. government emerges from Mexico’s elections.  Yet even as officials work intensely for a NAFTA deal, President Trump threatens to terminate the treaty.

What is at stake?

Jobs: Up to 14 million U.S. jobs are supported by NAFTA, including up to a million Texas jobs.  Ending NAFTA could cause the loss of up to 1.2 to 1.8 million U.S. jobs and 150-300,000 in Texas.

Trade: NAFTA trade totals some $1.2 trillion a year.  Texas exports annually over $112 billion to Mexico and Canada and trades $174 billion with Mexico alone, selling a wide variety of products.  If NAFTA ends, Texas could lose an estimated $12-54 billion in exports to Mexico.  The energy trade is a boon for Texas, helping to strengthen North America’s energy security.  37 percent of all Texas agricultural exports go to Mexico.  If NAFTA did not exist, Texas beef could face a 25 percent Mexican tariff.

Border transit: Each day, over 490,000 legal border crossings take place through Texas ports of entry.   Some 8 million Mexicans travel to Texas communities yearly, spending billions of dollars.

Security Cooperation:  The current cooperation between U.S. and Mexican federal law enforcement, intelligence, and security agencies is unprecedented against cross-border crime, illegal migration from Central America, and potential threats from terrorists and other bad actors.  In the last few years, Mexico has apprehended over 500,000 Central American migrants, greatly easing the burden at the U.S. southern border.  Cooperation against cross-border crime is more important than ever.  Mexican cartels feed U.S. demand for opioids and fuel rising violence in Mexico.  The cartels’ U.S. sales are estimated at $18-30 billion a year.  The United States and Mexico agreed on a joint strategy against the cartels in 2017.  Such collaboration is why ten former top U.S. military commanders wrote President Trump supporting NAFTA.  The critical tweets about Mexico have made it harder to maintain and deepen cooperation. Texas and the other U.S. border states will feel sharply the bad effects of less bilateral security collaboration.

A More Competitive America

America’s big economic challenge is competing with China.  Our two neighbors provide the skills, investment, and market specialization to do that more effectively.  It will be much harder to compete against China and other global commercial powers without a revitalized NAFTA.  A new agreement will incorporate digital and internet commerce.  It should encourage more efficient and secure cross-border trade.  According to one study, enhancing economic integration across the U.S.-Mexico border can add 700,000 to 1.4 million new U.S. jobs and $69-$140 billion in Texas, California, and other border state economies.

Trade officials are working intensely to achieve breakthroughs soon.  All three parties must show flexibility.  The United States must move constructively away from the positions it has taken on rules of origin for autos, a sunset clause for the agreement, dispute settlement mechanisms, and government procurement.  Texas Governor Abbott recently wrote the chief U.S. negotiator urging such flexibility.  The United States has offered some movement on rules of origin, but others say more is needed to forge a workable plan.  Canada and Mexico must be creative and flexible in addressing U.S. concerns.  Mexico must also accept and implement strong provisions on labor rights.  Canada needs to compromise on issues including its dairy protections.  All must grapple with threatened U.S. steel and aluminum tariffs and now public anger in Mexico.

Much work remains.   Some predict a long negotiation.  Yet, negotiators say agreement on major items and many chapters is possible in the weeks ahead with good will and hard work.  Even if an overall accord is not reached, conceptual agreement on key issues could allow technical work to continue and, importantly, reduce the uncertainty that harms all three economies, until after Mexico’s new President takes office in December.

Progress requires abandoning inflexible approaches and avoiding public spats. The goal is a productive long-term relationship with two neighbors who help assure U.S. security and prosperity.

Earl Anthony Wayne is a Public Policy Fellow at the Wilson Center, former U.S. Ambassador to Mexico, and former Assistant Secretary of State for Economic and Business Affairs, among other positions.  This article evolved from talks at Texas Tech University. This article was originally published on Forbes.com.