Mexico's President Enrique Peña Nieto's surprise decision to invite Donald Trump to Mexico City threw his country into confusion on Wednesday, with even party allies wondering why the deeply unpopular president would give an audience to a man who has made scapegoating Mexico the cornerstone of his campaign for the US presidency.

Trump's comments about Mexico and Mexicans have generated near universal distaste for the Republican Party candidate south of the border, as well as fear of what could happen if he is elected in November. Now Mexicans are digesting the news that Peña Nieto will sit down with Trump at the presidential residence this afternoon before flying on to Arizona to lay out what is expected to be a hard-line vision for US immigration policy.

"This man has called us criminals and rapists and said he is going to shut us out with a wall and screamed at us that we should pay for it, and then the president invites him to come and talk?" leading political analyst Jesús Silva-Herzog Márquez told VICE News. "I just cannot fathom why Peña Nieto would do this. This is the stupidest thing that I have seen a president do in my lifetime."

Silva-Herzog said that he could only speculate that Peña Nieto had been "overcome by naivety" and was hoping to show that he was a "great statesman" who can negotiate with anybody, and persuade Trump to take into account the real context and complexity of Mexican-US relations.

"But Trump is not a rational guy. He doesn't care about the facts. He will be able to use this how he wants," Silva-Herzog said. "There is no possibility that Peña Nieto can get anything out of this. Rather he is sending Trump a life jacket when he is drowning."

The meeting was first revealed by both Trump and Peña Nieto on their Twitter feeds on Tuesday night.

By midday on Wednesday, only the Mexico office of the Republican Party was giving any more details, announcing that it would be held in the presidential compound of Los Pinos in Mexico City in mid afternoon.

Peña Nieto's office did not confirm any specifics until minutes before the meeting began, presumably in order to reduce the risk of targeted demonstrations. Calls for protests emerged nonetheless, focused on the Angel of Independence monument in central Mexico City, though attendance was scant.

In the meantime social media buzzed with indignation, and ridicule.

One popular meme showed Peña Nieto in loincloth offering up a bleeding Mexican heart to a massive Aztec-style sculpture of Trump. Another showed the faces of the Mexican president and the American candidate superimposed on posters for the 90s movie Dumb and Dumber.

Hashtags ranged from the ironic #SrTrumpConTodoRespeto or "Mr Trump, with all due respect" to the straight up angry #TrumpNoEresBienvenido or "Trump you are not welcome."

That theme was echoed by a number of public figures, including potential candidates for Mexico's next presidential election in 2018.

"Mr @readlDonaldTrump, even if you are invited you should know you are not welcome" tweeted Margarita Zavala, the wife of former president Felipe Calderón, who is seeking the nomination of the opposition National Action Party. "Mexicans with dignity repudiate your discourse of hate."

Jorge Castañeda — a former foreign minister who is hoping to run for president as an independent — said that Trump would only be welcome in Mexico if he apologized before he came.

"It looks like an act of desperation by Peña as he tries to recuperate some momentum for the remainder of his term," Castañeda told Radio Fórmula.

Recent polls show Peña Nieto's approval ratings languishing in the low 20 percent range.

His low popularity reflects Mexico's rising murder rate within the context of the the government's failure to contain the country's drug cartels, as well as a sluggish economy and plunging peso.

Peña Nieto's image has also suffered from a steady stream of allegations of serious corruption. He even felt the need to apologize to the nation in July for creating "the perception" of a conflict of interest in relation to a mansion built for his family by a favored government contractor.

The government has pinned much of its hope for winning back public support on pushing through an education reform, but this is currently mired in major protests by teachers. The president's reputation was not aided either by last month's revelation that he plagiarized about a third of his undergraduate law thesis.

Now Peña Nieto is facing incredulity from members of his own party, the Institutional Revolutionary Party or PRI. Senate leader Emilio Gamboa stressed Peña Nieto's statesmanlike qualities in an interview on Radio Fórmula but he also went to great pains to stress that he was "very surprised" by the news of the meeting.

"How bad this is for Peña Nieto depends on what happens afterwards," according to political analyst Raymundo Riva Palacio. "Trump can go to Arizona and say anything he likes about what happened in the meeting and everybody will listen to him."