PHOENIXIn Summary
The visit came in the heat of the US presidential race, with Trump trailing Clinton in most polls.
Trump has routinely assailed Mexicans who illegally cross the border into the United States.
Trump has recently discussed prioritising the deportation of illegal immigrants with criminal records.
Republican White House hopeful Donald Trump traveled to Mexico Wednesday to tell President Enrique Pena Nieto that he will erect a border wall if elected, but controversy erupted over whether they discussed who would pay for it.
The tense international trip saw Trump navigating a political tightrope just 69 days before the US presidential election, as he seeks to clarify his stance on his campaign's signature issue: immigration.
Trump spent just hours on the ground in Mexico City before jetting back north to deliver a highly anticipated immigration policy speech in Phoenix.
After a year of lobbing insults across the border, the provocative billionaire candidate made the surprise visit to Mexico, seeking to seize control of the narrative and portray himself as a capable statesman on the international stage.
"We recognise and respect the right of either country to build a physical barrier or wall on any of its borders," Trump said at the presidential residence after he and Pena Nieto held closed-door talks.
He said they did not discuss who would foot the bill, despite Trump persistently stating throughout his campaign that Mexico would bear the financial burden for the highly controversial project.
"We didn't discuss who pays for the wall," Trump said.
Pena Nieto did not correct Trump at the press conference after their meeting, but later offered a contradictory account.
"At the start of the conversation with Donald Trump I made it clear that Mexico will not pay for the wall," Pena Nieto wrote on Twitter.
After that "the conversation covered other issues, and proceeded in a respectful manner," he wrote.
It was a day of high drama for both men, who found themselves face to face after exchanging criticisms from afar over the past year.
In a statement, the Trump campaign described the visit as "the first part of the discussion and a relationship builder.
"It was not a negotiation, and that would have been inappropriate," Trump communications advisor Jason Miller said.
"It is unsurprising that they hold two different views on this issue, and we look forward to continuing the conversation."
Trump's Democratic rival Hillary Clinton pounced, with her team arguing that Trump "lied" about whether he defended the centerpiece of his campaign when it counted.
"Trump just failed his first foreign test," Clinton tweeted. "Diplomacy isn't as easy as it looks."
Trump launched his campaign last year by declaring that Mexico was sending "rapists" and other criminals across the border. Months later, Pena Nieto likened Trump's isolationist positions to those of Nazi leader Adolf Hitler and fascist Benito Mussolini.
On Wednesday, prior to his tweet, Pena Nieto was more diplomatic.
"Even though we may not agree on everything, I trust that together we'll be able to find better prosperity and security."
But he did not hide the fact that many in his country have felt the sting of Trump's harsh rhetoric.
"Mexican people felt hurt by the comments made," Pena Nieto said alongside Trump. "But I'm sure that the genuine interest is to build a relationship that will give both of our societies better welfare."
Trump stunned the political establishment with his sudden trip south of the border, and it was clearly hostile territory.
"Trump not welcome in Mexico, not by me nor the 130 million Mexicans," tweeted the country's former president Vicente Fox.
The visit came in the heat of the US presidential race, with Trump trailing Clinton in most polls.
Pena Nieto, whose approval rating has plummeted since his 2012 election, also invited Clinton, but the former secretary of state's campaign has announced no plans for a visit.
She had choice words for Trump, however, upbraiding him for his Mexican "photo op" and signalling it was no way to build leadership credibility.
"It certainly takes more than trying to make up for a year of insults and insinuations by dropping in our on neighbors for a few hours and then flying home again. That is not how it works," Clinton said at an American Legion meeting in Ohio.
Trump has routinely assailed Mexicans who illegally cross the border into the United States.
Hard line immigration policies are a key plank of his campaign, but Trump has mulled whether to soften his positions, particularly the call early in his campaign to deport some 11 million undocumented migrants living in the shadows.
His Phoenix speech is seen as an opportunity to clarify his policy.
Trump has vacillated between reaching out to minorities and returning to the anti-immigration rhetoric admired by his most ardent supporters, mainly white working-class males.
He is threading a political needle. Trump has recently discussed prioritising the deportation of illegal immigrants with criminal records.
Critics and supporters will be watching closely to see whether Trump outlines any provisions that would allow some undocumented immigrants to stay in the country legally.