MEXICO CITY (AP) -- Mexican President Enrique Pena Nieto on Thursday canceled a planned Jan. 31 meeting with President Donald J. Trump, hours after Trump tweeted that the meeting should be scrapped if Mexico won't pay for a border wall.
Pena Nieto's message on Twitter ended days of uncertainty about how he would respond to Trump's aggressive stance toward the country, and illustrated the challenges world leaders are likely to face in dealing with Trump's voluble, Twitter-based diplomacy.
RELATED: President reveals how Mexico will pay for the wall
It also signaled a remarkable souring of relations between the U.S. and its immediate southern neighbor, one of America's largest trading partners and a country with which it shares a nearly 2,000-mile border.
"This morning we have informed the White House I will not attend the working meeting planned for next Tuesday," Pena Nieto tweeted.
"Mexico reaffirms its willingness to work with the United States to reach agreements that benefit both nations," he added.
White House press secretary Sean Spicer responded to the Mexican president's announcement, saying: "We'll look for a date to schedule something in the future. We will keep the lines of communication open."
Earlier Thursday, Trump had tweeted that "If Mexico is unwilling to pay for the badly needed wall, then it would be better to cancel the upcoming meeting" in Washington D.C.
Trump said Wednesday he would start building a U.S.-Mexico border wall and has vowed to make Mexico pay for it. Mexico opposes the wall and has repeatedly said it won't pay.
Officials had said Mexico was "considering" canceling after the border wall announcement, but Trump appeared to beat Mexico to the punch in that game of brinkmanship.
Former foreign relations secretary Jorge Castaneda told local media that after Trump's tweet, "Pena Nieto has no other choice but to say 'I'm not going.'"
Trump's unpredictable style appeared to catch Mexico's normally quiet and cautious diplomacy off guard.
"I think that, in general, diplomacy is not conducted via Twitter," Finance Secretary Jose Antonio Meade told Radio Formula.
Mexico's best-known opposition politician, leftist Andres Manuel Lopez Obrador, tweeted that "in the face of Trump's latest outburst, don't go to the meeting, and submit an urgent complaint to the U.N. for human rights violations."