Donald Trump's surprise visit to Mexico to meet with President Enrique Peña Nieto on Wednesday presents a curious turn in the narrative of the American presidential campaign. Trump announced his candidacy by both insulting Mexican immigrants — demonizing then as "rapists" — and then making a far-fetched promise: the construction of a fortified border wall paid for by the Mexican government.

Now, just before a big speech on immigration, he seems to be making nice with Peña Nieto, a president whose government Trump earlier described as "totally corrupt." Both men, as PostEverything's Dan Drezner points out, need the political winds to blow in their favor ahead of tough upcoming elections. It seems unlikely the gambit will work that well for either of them.

It should also come as no surprise that senior Mexican officials have their own negative opinions about the American business mogul-turned-politician. And that includes the president, who earlier this year waded into the debate over Trump's rhetoric on Mexico and likened the GOP nominee to fascist leaders from the past.

"That’s how Mussolini got in, that’s how Hitler got in. They took advantage of a situation, a problem,” Peña Nieto told the newspaper Excelsior in March, offering his explanation of Trump's rise.

In June, he toned down his rhetoric, instead explaining that he was offering a critique of Trump's populism: "In different places we are presented with political actors and political leaders who assume populist and demagogic positions, and try to eliminate or destroy … that which has taken decades to build."

Critics of Peña Nieto were quick to suggest he's also trying to head off populist challenges to his own rule in Mexico by conflating them with Trump. Nevertheless, the president's predecessor and other opponents do share a similar dim view of the Republican candidate.

"I think [Trump's] logic of exalting white supremacy isn’t even acting against immigration. … It is acting and speaking against immigrants who have a different skin color than him, which is frankly racist and is a bit like the exploitation of raw nerves that Hitler did in his day," said former president Felipe Calderón earlier this year.

Another former president, Vicente Fox, has been even more outspoken, repeatedly going on American television to denounce Trump and his absurd proposal to force Mexico to pay for his border wall.

"Wake up, Americans, he’s a false prophet," Fox said on a political podcast in February. "Think about it, analyze what he’s proposing. Count the amount of lies he says in every speech. Everyday he lies and lies with figures because his sole interest is to do personal business, to get greedy, to get more money, to put the Trump name everywhere in the world."

He went on: "I’m not going to pay for that f---ing wall, and please don’t take out the f---ing full word,” Fox continued. “He’s crazy. He is crazy."

But Fox, as well as other Mexicans on both sides of political spectrum, is irate that Peña Nieto has invited Trump to pay a visit, as my colleague Josh Partlow reported today.

"Trump is using Mexico, is using President Peña to boost his sinking poll numbers," Fox said on CNN, suggesting the invitation in some way legitimizes Trump's politics. "I think that President Peña is taking an enormous political risk by hosting Trump."

Contempt for Trump is widespread in Mexico and has spawned social media memes, spoof plays and an industry of Trump-shaped piñatas. On Wednesday, the hashtag #SrTrumpConTodoRespeto trended globally on Twitter; it means "Mr. Trump, with all due respect," but mostly involved tweets directed at the Republican nominee with not particularly respectful language.

"Against Trump, we cannot stay on the defensive. No one has reviled us like this since [President James K.] Polk in 1846,” tweeted Mexican historian and author Enrique Krauze in February, referring to the American president who invaded Mexico in the mid-19th century.

In March, legislators in Mexico City passed a symbolic proposal to ban Trump from the country, in a bid to push Pena Nieto to take a more a forceful line against the Republican nominee.

"What we’re saying is that if he wants to build a wall so that Mexicans can’t enter his country, then he is not welcome in our country,” José Manuel Delgadillo, one of the local deputies, said.

Some of Mexico's most famous global stars have also joined the chorus of condemnation.

"So that really is the genesis of genocide, where it kind of sparks," said acclaimed Mexican actor Gael García Bernal in an interview earlier this year in which he discussed Trump's nativist rhetoric. "So this hatred should be stopped and the best way to stop it is coming out to vote."

In the same interview, he said: "I would suspect that anyone with a human heart will vote against people who talk that way."

Mexican actor and director Diego Luna expressed similar gloominess about Trump supporters.

"Sadly there are a lot of ignorant people that have access to a microphone," Luna told Fox News Latino last year when asked about Trump. "What is scary … is the following he has."

And the Mexican filmmaker Alejandro Iñárritu, who won multiple awards for "The Revenant" this year, warned Americans that Trump's proposals "betray the foundation of this country. The power of this country [the U.S.] relies on diversity."

Read more: