Mexico is increasing efforts to diversify its markets and introduce new investor protections as it prepares for the possibility that negotiations over the future of the North American Free Trade Agreement could break down.

Negotiators are increasingly concerned that they will not be able to bridge gulfs between the US and Mexico in the talks. Sticking points include Washington’s proposed “sunset clause” that would kill off the pact unless it is renegotiated every five years, and its demands for higher US content in regionally-made cars.

Mexican officials are therefore encouraged by signs that new markets are opening up.

While the country is heavily dependent on the US for both imports and exports, it has imported more yellow corn from Brazil and Argentina in September than in the whole of 2016.

“Uncertainty is going to play into the decisions of companies — if they no longer have a reliable source of imports, they’re going to look for one,” said one senior government official who asked not to be named. “The numbers are small so far but this is just a little taster of what they could do.”

Mexico bought 100,800 tonnes of yellow corn from Brazil in September and 41,000 from Argentina — a drop in the ocean compared with the 10.5m tonnes bought from the US. But so far this year, it has bought 11 per cent more of the commodity from the two South American countries than in all of 2016, according to government data.

“It’s important because it shows Mexico has other countries where it can substitute grain imports,” said Juan Carlos Anaya, director-general of CGMA, a consultancy.

Part of that is price-driven — Brazil and Argentina have record harvests that they need to sell, so prices have come down. The US Grains Council is taking comfort in that for now, seeing only “short windows” of opportunity for Brazil and Argentina as harvests outstrip storage capacity.

“We are not completely alarmed yet,” said Ryan LeGrand, USGC director in Mexico. “We don’t think it will become a trend. We expect the US to continue to dominate provided we are able to come to an agreement in Nafta.”

But with a crunch round of talks in Mexico City on November 17-21, economists are taking a stark look at the cost of losing Nafta. Ildefonso Guajardo, Mexico’s economy minister, told Congress last week that the way things stood, an end to Nafta “cannot sanely be ruled out”.

Spanish bank Santander believes the economy could contract 2.6 per cent if Nafta died and the US went to a full trade war rather than reverting to World Trade Organization tariff rules. Moody’s Investors Service says the economy could shrink as much as 4 per cent.

Against that backdrop, Mexican officials have begun looking at writing Nafta trade protections into the country’s law — one of various tools to reassure investors for whom Nafta has been, above all, a guarantee that their interests were safe.

“Discussions have taken place,” said Gerónimo Gutiérrez, Mexico’s ambassador to the US. “As we enter this period in Nafta negotiations, Mexico is obliged to look at all possible scenarios and to be ready,” he added.

“You can certainly put in a foreign investment law that alludes to universal protections that are protected by a constitution,” said Mélida Hodgson, a partner at law firm Foley Hoag who specialises in investor-state and commercial arbitration and is a Nafta arbitrator.

Luis de la Calle, a former Nafta negotiator, said, however, that replicating the binding commitments of an international treaty in domestic law would be impossible.

But he said that if the US pulled out and Nafta remained in force between Canada and Mexico, the remaining trade protections would provide an incentive for US companies to invest in Mexico via Canada.

For now, Mexico is not about to walk away from the table — “Mexico will not give Donald Trump the excuse to say that we are to blame for the demise of Nafta,” said the unnamed senior official.

And even if Nafta dies, “half of what we export to the US will continue to enjoy duty-free access because tariffs are already zero”, the official added.

But calculations from Santander suggest the pain could be considerable. It forecasts a 15 per cent drop in exports and a 16 per cent fall in imports if Nafta ends and a full trade war erupts.