Donald Trump told Mexican President Enrique Pena Nieto on Wednesday he would build a border wall to keep illegal migrants out if he wins the U.S. presidency, but Pena Nieto held fast to his position that Mexico would not pay for it.

Contradicting Trump's assertion that the pair did not discuss who would pay for his proposed wall, Pena Nieto said after the departure of the Republican presidential candidate that he told him during their private meeting in Mexico City that his government would not pick up the bill.

"At the beginning of the conversation with Donald Trump I made it clear that Mexico will not pay for the wall," Pena Nieto said in a tweet after not mentioning the issue during their joint news conference.

Trump gave a different account of the conversation, which was aimed at repairing relations damaged by the real estate mogul's attacks on Mexico and migrant workers on the campaign trail.

"We did discuss the wall, we didn’t discuss payment of the wall, that will be at a later date, this was a very preliminary meeting. It was an excellent meeting," Trump said.

His campaign waved off Pena Nieto's statement, calling the meeting a first attempt at building a relationship.

"It was not a negotiation, and that would have been inappropriate. It is unsurprising that they hold two different views on this issue, and we look forward to continuing the conversation," Trump spokesman Jason Miller said.

Many Mexicans were furious about Trump's visit, deeply offended by how Trump has labeled Mexicans as rapists and drug traffickers, and wanted an apology. That did not come.