Donald Trump tried to convince the Mexican president to stop publicly saying that he would not pay for a wall on the US-Mexico border, transcripts from a phone conversation between the two leaders have revealed.

Building a border wall was one of Trump's key election pledges but he has not come any closer to realising it due to Mexico's reluctance to cooperate.

Trump has always said that Mexico will pay for the 40f-high and 1,300 mile-long wall, which the US Department of Homeland Security estimates would cost $21.6bn (£17bn).

But during a phone call with Mexican President Enrique Peña Nieto, Trump acknowledged that the funds would come from other sources, transcripts obtained by the Washington Post revealed.

He told Peña Nieto that when asked by reporters who was going to pay for the wall, they should both say "we will work it out" as opposed to "you saying, 'we will not pay' and me saying, 'we will not pay.'"

"It will work out in the formula somehow," Trump reassured the Mexican president.

But Peña Nieto responded that he would not stop publicly refusing to pay for the wall.

"Let us stop talking about the wall," he told Trump. "I have recognised the right of any government to protect its borders as it deems necessary and convenient. But my position has been and will continue to be very firm saying that Mexico cannot pay for that wall."

Trump said that the wall was "the least important thing" the leaders were discussing, but that "politically it might be the most important".

He stressed that even if Peña Nieto was not planning on paying for the wall, he should not make that clear to the media.

"But you cannot say that to the press," the president said. "The press is going to go with that and I cannot live with that. You cannot say that to the press because I cannot negotiate under those circumstances."

"The fact is we are both in a little bit of a political bind because I have to have Mexico pay for the wall — I have to," he added. "I have been talking about it for a two-year period, and the reason I say they are going to pay for the wall is because Mexico has made a fortune out of the stupidity of US trade representatives."

He also tried to convince the Mexican president that the wall would cost a lot less than official estimates.

"It will be much lower than these numbers I am being presented with, and it will be a better wall and it will look nice. And it will do the job," he said.

The Washington Post also published transcripts of Trump's heated first call with Australian Prime Minister Malcolm Turnbull.