On January 26, Mexican President Enrique Pena Nieto faced off with US President Donald Trump on Twitter. They both took credit for cancelling a meeting they were scheduled to have in Washington DC on January 31.
Political commentators and the Mexican public had been asking for a cancellation of the meeting after Trump decided to stick to his position that Mexico will have to pay for a wall along the US-Mexico border. The online standoff was seen an embarrassment for President Pena, who has advocated for dialogue with Trump.
It is time that the Mexican government switches gears and moves forward with tougher policies on the US, seeking to break its economic dependence on US markets. Not doing so will bring great perils to Mexico and set a bad precedent for Latin America.
For much of the 20th century, the Mexican state encouraged nationalism based on the idea that Mexico was at its core a Latin American country (not a North American one), sharing a common revolutionary heritage with its southern neighbours.
In a radical departure from this ideology that gave birth to Mexico on the eve of the 20th century, the Mexican government started improving relations with the US in the 1990s. This change was led by a group of US-educated technocrats who populated the Mexican government and pushed the idea that Mexico's future lay north, neglecting relations with other Latin American countries.
One of their main arguments was that looking north benefited Mexico as the US economy was bigger and thus held better prospects for Mexico.
The North American Free Trade Agreement (NAFTA), which Mexico, the US and Canada signed in 1994, was the cornerstone of that political consensus, paving the way for significant economic dependence.
As a result, Mexico's economy developed to cater overwhelmingly to US import needs; almost 80 percent of Mexican exports now go north across the border.
Whole industries were dedicated to US consumer needs. For example, Mexico became the world's seventh biggest car manufacturer with support from the US and a steady supply of US-made car parts; the vehicles it produces are almost exclusively exported to the US.
Economic dependence led to political acquiescence to US domination of Mexico's foreign policy. In 2002, Mexico hosted the International Conference on Financing for Development which a number of Latin American leaders attended, including the late Cuban leader Fidel Castro.
Amid pressure from the US, then Mexican President Vicente Fox called the Cuban leader and asked him to only attend the leaders' lunch and then leave in order to please US President George W Bush, who was also in attendance. This sparked popular outrage in Mexico.
In more recent years, the US has played an important role in Mexico's internal security decisions. As the number of Central Americans attempting to get into the US surged, the US government provided financial support to Mexico to help it detain and deport migrants en route to the US. As a result, in 2016 the number of migrants detained in Mexico increased threefold compared to 2012.
True to the tradition of his predecessors accommodating the US at any cost, Pena tried to have a dialogue with Trump, despite his anti-Mexican posturing.
In August 2016, while Trump was struggling in the polls, he invited him to his office. The visit was widely criticised within Mexico and prompted the organiser of the meeting, then Finance Minister Luis Videgaray, to resign.
After Trump's election, Videgaray came back to the cabinet as foreign minister. It was rumoured that he has close ties with Jared Kushner, Trump's son-in-law and adviser, and was tasked to manage the relationship with the new US administration.
New Mexican foreign policy
Mexicans are not happy with Pena's approach. They are very proud of their heritage, their culture and its effect on the world, and see Pena's weakness in front of Trump as humiliating.
It is imperative that Pena listen to his people and stand up to Trump. It is time for the Mexican government to change its foreign policy towards the US and be bolder in its approach.
Pena must be clear that Mexico will not tolerate Trump's tantrums. If Trump decides to pursue his populistic policies, then Mexico must be ready to seek alternatives and a future of its own. In doing so, Mexico can lead with an example of how developing countries can break free from the chains that tie them to industrialised powers.
Last Thursday's Twitter embarrassment, just like the August one, was the result of Videgaray's actions. He should resign and Pena should appoint an experienced diplomat who can introduce tough new policies to stand up to Trump.
Mexico needs to be serious about leaving NAFTA. Mexico shouldn't be willing to tolerate any embarrassment for the sake of staying within NAFTA. The free trade agreement has brought positive results mainly to the north of Mexico, but many swaths of the agricultural south have deeply suffered from US competition. Small Mexican producers can't compete with the US' subsidised industrialised farming.
OPINION: Latino resistance under Trump
In today's interconnected world, there are vast markets that the Mexican economy can tap into. China is one of them. Pena should consider very seriously strengthening relations with China. In recent years China has sought a closer relationship with Latin America, but Mexico hasn't been a major part of this endeavour because of its US focus.
Mexico must also vow not to deport any foreign citizens in Mexico en route to the US. Pena should immediately instruct all federal agencies to stop detention and deportations of the 120,000 Central Americans who cross Mexico annually trying to reach the US. The government should provide shelter and humanitarian aid to them and stop mistreatment.
Mexico should set an example for the rest of the Latin American countries to follow in facing an uncooperative US president and looking for foreign policy alternatives.
If they don't do so, Mexico and other Latin American countries risk becoming Trump's backyard and being continually humiliated. Relations with the US are not as valuable as national sovereignty and that should never be compromised on.
Miguel Guevara was born and raised in Cuernavaca, Mexico. He holds a Master's degree in public policy from Harvard University's John F Kennedy School of Government. He currently lives and works in California, where he collaborates with Latino community organisations.
The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.