“I regret and condemn the United States’ decision to continue with the construction of a wall that, for years now, far from uniting us, divides us,” he said.
It mattered little to Mexicans whether Mr. Trump’s order would receive congressional approval or the funding required to fulfill it.
The perceived insults endured during the campaign had finally turned into action. Decades of friendly relations between the nations — on matters involving trade, security and migration — seemed to be unraveling.
Calls began to come in from across the political spectrum for Mr. Peña Nieto to cancel his visit, and to respond with greater fortitude to the perceived menace from President Trump. On Twitter, Mr. Trump’s action was referred to by politicians and historians as a “an offense to Mexico,” a “slap in the face” and a “monument to lies.”
Historians said that not since President Calvin Coolidge threatened to invade a “Soviet Mexico” had the United States so deeply antagonized the Mexican populace.
“It is an unprecedented moment for the bilateral relationship,” said Genaro Lozano, a professor at the Iberoamerican University in Mexico City. “In the 19th century, we fought a war with the U.S.; now we find ourselves in a low-intensity war, a commercial one over Nafta and an immigration war due to the measures he just announced.”
The fear of many in Mexico is that Mr. Trump’s remarks will force Mr. Peña Nieto’s hand. While the Mexican president has opted for dialogue over confrontation, the building pressure, and perceived slights, could complicate his agenda.
That could ultimately lead to disastrous consequences. With Nafta gone, both countries would be likely to suffer significant damage to their economies, and Mexico could see a sharp decline in foreign investment. The United States, meanwhile, might find its southern neighbor far less willing to cooperate on issues of security.
Pressure from the political opposition could also color the Mexican government’s response. During a rally, the leftist politician Andrés Manuel López Obrador asked for Mr. Peña Nieto to appeal to the United Nations and accused Mr. Trump of “violating human rights” and of racism.
Mr. López Obrador, who ran a close race against Mr. Peña Nieto for president in 2012, said the actions by Mr. Trump on Wednesday were “a great opportunity for Peña to begin his defense of Mexican immigrants, with steadiness and dignity.”
And while Mexico does not want a war of words — or a trade war — with Washington, the dynamic has already started to change. In recent days, top government officials said they would be willing to walk away from Nafta if the negotiations did not suit Mexico’s interests. That position was unthinkable even a few months ago.
For a new American president, Mr. Trump is both well known in Mexico and widely disliked. His remarks have unified an otherwise fractious country, where corruption, a shaky rule of law and economic struggles have alienated many and kept them from becoming politically engaged. As Mr. Trump’s promises have begun to materialize into action, the public discourse is changing.
Some fear the worst.
“Diplomatic relations are ever changing, never static, but there is a real concern that this wall, as a powerful symbol of national resolve, will unleash a blunt, raw nationalism in Mexico,” said Allert Brown-Gort, a professor of international relations at the Autonomous Technological Institute of Mexico. “It would be similar to the one the American government is showing, and would undermine all efforts for the relations to go back to their normal state.”
The Trump broadside on Wednesday, coming as the Mexican foreign minister, Luis Videgaray, was to begin preliminary talks in Washington, was a new low in bilateral relations.
Mr. Videgaray orchestrated Mr. Trump’s visit to Mexico during the campaign last year, when he was finance minister. The move drew such widespread condemnation that Mr. Videgaray resigned.
After Mr. Trump’s victory, Mr. Videgaray’s fortunes revived and he became foreign minister. But any hope that his invitation to Washington could be leveraged in Mexico’s favor now seem dashed.
Many Mexicans said conciliatory gestures were no longer an option.
“It’s like we are Charlie Brown and they are Lucy with the football,” said Jorge Castañeda, a former foreign minister. “Peña is a weak president in a weak country at a weak moment, but he has to find a way to get some official backbone.”
Still, despite the outrage, there was a recognition that the action was more political than substantive, like the wall itself. A meaningful stretch of the United States border is already lined with a wall, and illegal immigration persists.
“Symbolic gestures are not going to change the fact that we’re neighbors and that our countries will affect each other in perpetuity,” said Carlos Pascual, a former United States ambassador to Mexico. “We have no choice but to keep working for better solutions.”
Others took talk of a wall with a grain of salt, figuring Mexican creativity, or ingenuity, would render it useless anyway.
“This is just politics, it won’t upend life in Mexico,” said Ariel Najum, 39, who runs a family business. “You know how Mexicans are: If they go high, we go underneath, with tunnels