It is still early to declare winners and losers in the new US-Mexican trade deal, but in Mexico it looks like an unexpected victory for leftist President-elect Andres Manuel Lopez Obrador.
Announced with typical flare by US President Donald Trump on Monday, the two-way deal to replace the North American Free Trade Agreement meanwhile left NAFTA's third member, Canada, out in the cold -- at least for now.
In Mexico, the news brought a collective sigh of relief: finally, months of uncertainty over the country's most important trade relationship appeared to be over.
All three countries had been rushing to finish a deal before Lopez Obrador, a sometimes brutal critic of free trade, takes office on December 1.
But ironically, according to nearly everyone involved, Lopez Obrador and his team played a key role in sealing the deal, after being invited to join the negotiations by current President Enrique Pena Nieto.
"Speaking with and working President-elect Lopez Obrador has been absolutely a very, very special time," said Trump.
Mexican Foreign Minister Luis Videgaray said Lopez Obrador's backing was "essential," while Economy Minister Ildefonso Guajardo said the president-elect's delegate to the talks, Jesus Seade, played a "fundamental role."
- Pragmatism over ideology -
The politician known as "AMLO," who won a landslide election victory on July 1, had attacked NAFTA in the past.
But pragmatism appears to have won out over ideology.
"It's a win for Lopez Obrador, on so many levels," said Mexican economist Valeria Moy.
Not only does he clear an explosive issue off the decks before taking office, he maneuvers into a position that all politicians love: if the deal is seen as a huge success, he can take credit; if it all falls apart, he can blame his predecessor.
"He'll get the economic benefits... but also washes his hands of the potential costs," said Moy.
Nearly 25 years after it took effect, on January 1, 1994, NAFTA is popular in Mexico.
One recent poll found 78 percent of Mexicans think it is good for the economy.
"It's undeniable that NAFTA has had huge benefits for Mexico... It hasn't solved all ills, but it's been very good for the country," Mexican trade expert Hugo Perezcano Diaz told AFP.
"And Lopez Obrador needs the business sector. Mexico has a very important and powerful business sector, and speaking out in favor of NAFTA brings him closer to them."
- Art of the deal -
But Lopez Obrador may have inadvertently helped Trump back Canada into a corner.
Perezcano, who works in Canada, summed up the feeling in his adopted country as Foreign Minister Chrystia Freeland cut short a trip to Europe to jet into Washington for do-or-die talks on keeping the new agreement a three-country deal.
"The expression here is, 'Mexico threw Canada under the bus,'" he said.
In an episode worthy of reality TV, Trump put Pena Nieto on speaker phone Monday, live on national television, to laud the "fantastic" deal with Mexico, while warning the Canadians he was feeling inclined to leave them out of it.
Freeland graciously brushed aside any acrimony as she arrived in Washington on Tuesday, however.
Thanks to Mexico's "tough decisions," the bilateral deal now "clears the way" for the US-Canada talks, set to open Wednesday, she said.
- What's in it for Mexico? -
Full details of the deal have not been released yet, but Mexico appears to have gotten its way on several key issues.
NAFTA's dispute resolution system stayed in, Trump's idea for seasonal tariffs on agricultural imports stayed out, and his proposal for a five-year "sunset clause" was changed to six-year reviews, with a minimum 16-year lifespan for the deal.
Above all, Mexico got certainty -- or the appearance of it -- on its relationship with the country that buys some 80 percent of its exports.
The United States meanwhile got its way on one key issue close to Trump's heart: bolstering the American auto industry.
The new deal raises the amount of a car's content that must be produced in the region to avoid tariffs from 62.5 to 75 percent, and now requires at least 40 percent to be made by workers earning $16 an hour or more.
But Trump's main victory was political, said Perezcano, of the Ontario-based Centre for International Governance Innovation.
"Politically, (Trump) has declared victory, clearly eying the (US midterm) elections in November."
The losers will meanwhile include consumers, including American ones, said Mexican economist Jonathan Heath.
"The problem is that it's not the best thing, economically speaking. Consumers in all three countries are going to lose, because cars are going to cost more... and other goods, too," he said.