When I first landed in Mexico City in January 1996 as a newly minted PhD, the country was still reeling from the effects of the 1994-95 peso crisis and public safety was still a major problem in the capital. The ink on the Nafta treaty was still fresh and trade between Mexico and its northern neighbour was about to expand exponentially after the economic recession. Mexicans still had deeply held suspicions about the United States, often manifested through a fear that it wanted to steal their oil wealth. Mexicans felt the US could not be trusted and “anti-yanquismo” was still prevalent.

Over the next 21 years, Mexicans came to redefine their feelings towards the US and the two economies and societies have become deeply entwined. A growing assumption emerged that they were on a path of ever-deeper integration, not just in their economic relationship, which statistics show is marked by profound (albeit asymmetrical) interdependence, but through their societies.

The US has become more Mexican, with nearly 36 million people of Mexican origin living there, and more than a million US citizens living in Mexico. The two cultures have come to understand each other at a level of intimacy that would have been considered fantastical two decades ago, as TV events, music and festivals have become commonly shared icons. Cinco de Mayo and El Grito are celebrated across the US and many Americans even understand the difference between them.

Mexico and the US became friends and partners and were moving enticingly towards becoming allies. Mexicans felt favourably towards the US, particularly during the Obama years, and a sense of being part of North America emerged. Anti-yanquismo, it seemed, had been vanquished.

There were many challenges. The events of 9/11 drew an initially confused reaction from Mexico City and the US military action in Iraq forced Mexico to announce that it could not support the US in the UN. Corruption scandals in Mexico and repeated human rights concerns caused tension. And the constant irritants of drugs, violence, border security and illegal immigration have prevented a wholehearted acceptance of Mexican partnership in Washington and across the US. But the overall trajectory has been one of rapprochement. Beyond trade, the Merida Initiative brought the countries to an understanding on security affairs and they work closely intelligence sharing and military relations and the fight against organised crime. In 2014, Mexico began to collaborate on stemming migration by implementing a border plan on its frontier with Guatemala. We have gone from enemies to economic partners and friends in a breathtakingly short period .

How fragile that progress appears now. As Mexico’s foreign and economy ministers were engaged in talks at the White House, President Trump threw the relationship into disarray, insisting that Mexico must pay for a new border wall and threatening a 20% tariff on Mexican imports, forcing President Enrique Peña Nieto to cancel his planned visit to Washington on Tuesday.

The Mexican government and its people are in shock, but the week’s events have forged a sense of national unity. Normally taciturn billionaire Carlos Slim gave an extraordinary press conference on Friday in which he urged Mexico to bolster its internal market to gain more independence and historian Lorenzo Meyer wrote that a break with Trump would grant a “second independence”.

Former presidents Calderon, Fox and Zedillo have supported Peña Nieto. Their message is simple: the time for a conciliatory tone has passed. A new, more strident nationalism has emerged. Strength and determination, a willingness to sacrifice Nafta if need be, to withdraw security and migration co-operation with the US and the urgency of finding new friends are the primary elements of the emerging strategy. Mexico is not short of friends. There has been an outpouring of support from media in the US, Europe, Latin America and Asia. The US business community depends upon a binational production platform to maintain its competitiveness in domestic and global markets. Perhaps most significant were the comments of the Chinese ambassador to Mexico, Qiu Xiaoqi. On Friday, he offered his country’s support and interest in injecting new energy into the countries’ relationship, emphasising that this was not directed “against any third country”.

On Thursday, I lunched with a Mexican government representative. After briefly staring at each other in disbelief at what had transpired, he said: “We knew it was coming, but we didn’t know how bad it would be.” Then he told me something more important. Mexican nationalism, and anti-yanqui sentiment, he claimed, never disappeared. It was put away in a trunk that had been quietly gathering dust for 20 years. The events of the past week have forced a lot of Mexicans to remember that feeling and some politicians are enthusiastically dusting off the trunk and looking for the key.

Duncan Wood is the director of the Mexico Institute at the Wilson Center in Washington