President Trump made building a wall along the southern U.S. border and forcing Mexico to pay for it core pledges of his campaign.

But in his first White House call with Mexico’s president, Trump described his vow to charge Mexico as a growing political problem, pressuring the Mexican leader to stop saying publicly that his government would never pay.

“You cannot say that to the press,” Trump said repeatedly, according to a transcript of the Jan. 27 call obtained by The Washington Post. Trump made clear that he realized the funding would have to come from other sources but threatened to cut off contact if Mexican President ­Enrique Peña Nieto continued to make defiant statements.

[Mexicans react to transcript of Trump call with their president]

The funding “will work out in the formula somehow,” Trump said, adding later that “it will come out in the wash, and that is okay.” But “if you are going to say that Mexico is not going to pay for the wall, then I do not want to meet with you guys anymore because I cannot live with that.”

He described the wall as “the least important thing we are talking about, but politically this might be the most important.”

The heated exchange came during back-to-back days of calls that Trump held with foreign leaders a week after taking office. The Post has obtained transcripts of Trump’s talks with Peña Nieto and Australian Prime Minister Malcolm Turnbull.

Produced by White House staffers, the documents provide an unfiltered glimpse of Trump’s approach to the diplomatic aspect of his job, subjecting even a close neighbor and long-standing ally to streams of threats and invective as if aimed at U.S. adversaries.

The Jan. 28 call with Turnbull became particularly acrimonious. “I have had it,” Trump erupted after the two argued about an agreement on refugees. “I have been making these calls all day, and this is the most unpleasant call all day.”

Before ending the call, Trump noted that at least one of his conversations that day had gone far more smoothly. “Putin was a pleasant call,” Trump said, referring to Russian President Vladi­mir Putin. “This is ridiculous.”

The White House declined to comment. An official familiar with both conversations, who refused to speak on the record because the president’s calls have not been declassified, said: “The president is a tough negotiator who is always looking to make the best possible deals for the American people. The United States has many vital interests at stake with Mexico, including stopping the flow of illegal immigration, ending drug cartels’ reach into our communities, increasing border security, renegotiating NAFTA and reducing a massive trade deficit. In every conversation the president has with foreign leaders, he is direct and forceful in his determination to put America and Americans first.”

The official noted that Trump has since met both the Australian and Mexican leaders in person and had productive conversations with them.

(Elyse Samuels/The Washington Post)

The transcripts were based on records kept by White House note-takers who monitored Trump’s calls. Known as a “memorandum of conversation,” such documents are commonly circulated to White House staffers and senior policymakers.

Both documents obtained by The Post contain notes indicating that they were reviewed and classified by retired Lt. Gen. Keith Kellogg Jr., who serves as chief of staff on the National Security Council.

Portions of Trump’s strained conversations with Turnbull and Peña Nieto were reported earlier this year. But the transcripts trace the entire course of those calls from greeting to confrontation to — in the case of Turnbull — abrupt conclusion.

Both phone calls centered on ­immigration-related issues with high political stakes for Trump, who built his campaign around vows to erect new barriers — physical and legal — to entry to the United States.

But there was little discussion of the substance of those plans or their implications for U.S. relations with Australia and Mexico. Instead, Trump’s overriding concern seemed to center on how any approach would reflect on him.

“This is going to kill me,” he said to Turnbull. “I am the world’s greatest person that does not want to let people into the country. And now I am agreeing to take 2,000 people.”

[Trump berated Australia’s prime minister over a refugee policy he barely understood]

The agreement reached by the Obama administration actually called for the United States to admit 1,250 refugees, subject to security screening. A White House readout of the Trump call, issued at the time, said only that the two leaders had “emphasized the enduring strength and closeness of the U.S.-Australia relationship.”

Trump spent much of his call with Peña Nieto seeking to enlist the Mexican president in a deal to stop talking about how the wall would be paid for. Two days earlier, Trump had signed an executive order mandating construction of the wall, but funding for it remains unclear.

“On the wall, you and I both have a political problem,” Trump said. “My people stand up and say, ‘Mexico will pay for the wall,’ and your people probably say something in a similar but slightly different language.”

Trump seemed to acknowledge that his threats to make Mexico pay had left him cornered politically. “I have to have Mexico pay for the wall — I have to,” he said. “I have been talking about it for a two-year period.”

To solve that problem, Trump pressured Peña Nieto to suppress the issue. When pressed on who would pay for the wall, “We should both say, ‘We will work it out.’ It will work out in the formula somehow,” Trump said. “As opposed to you saying, ‘We will not pay,’ and me saying, ‘We will not pay.’ ”

Peña Nieto resisted, saying that Trump’s repeated threats had placed “a very big mark on our back, Mr. President.” He warned that “my position has been and will continue to be very firm, saying that Mexico cannot pay for the wall.”

Trump objected: “But you cannot say that to the press. The press is going to go with that, and I cannot live with that.”

Searching for an exit, Peña Nieto reiterated that the border plan “is an issue related to the dignity of Mexico and goes to the national pride of my country,” but he agreed to “stop talking about the wall.”

The exchange suggests that even at the outset of his presidency, Trump regarded the prospect of extracting money from Mexico as problematic but sought to avoid acknowledging that reality publicly.

Trump reiterated that vow as recently as last month, when he said during a summit of world leaders in Germany that he “absolutely” remained committed to forcing Mexico to pay for the wall. Weeks later, however, the House approved a spending bill setting aside $1.6 billion for a structure that is projected to cost as much as $21 billion.

[Trump admits he punked his supporters on Mexico paying for the wall]

Trump told Peña Nieto that he knew “how to build very inexpensively . . . and it will be a better wall and it will look nice.” He has suggested that the money could come from border taxes and even threatened to block remittance payments that flow from workers in the United States to relatives in Mexico, but has yet to provide complete plans or funding details.

Trump also lashed out at Peña Nieto over the U.S. trade deficit with Mexico and the flow of illegal drugs into the United States.

“We have a massive drug problem, where kids are becoming addicted to drugs because the drugs are being sold for less money than candy,” Trump said. “I won New Hampshire because New Hampshire is a drug-infested den.”

Trump won the Republican primary in New Hampshire, but Hillary Clinton carried the state in the general election.

He described Mexican drug cartel leaders as “pretty tough hombres” and promised U.S. military support, saying that “maybe your military is afraid of them, but our military is not.”

Peña Nieto responded by saying that drug trafficking in Mexico is “largely supported by the illegal amounts of money and weapons coming from the United States.”

[Trump talked about sending troops to battle ‘tough hombres’ in Mexico. Can he do that?]

Trump also threatened to impose tariffs of up to 35 percent on imports from Mexico, saying that as president he had been given “tremendous taxation powers for trade,” even though tariffs are mainly the province of Congress.

Despite the friction, Trump at other moments sought to sweet-talk Peña Nieto, telling him that “you and I will always be friends,” and that if they could resolve their disputes over the border and trade, “We will almost become the fathers of our country — almost, not quite, okay?”

Although Australia is one of the United States’ closest allies, Trump’s call with Turnbull was even more contentious. The prime minister opened by noting that he and Trump have similar backgrounds as businessmen turned politicians. Trump also inquired about a mutual acquaintance, the Australian golfer Greg Norman.

But the conversation devolved into a blistering exchange over a U.S. agreement to accept refugees from Australian detention centers on Papua New Guinea’s Manus Island and the island nation of Nauru. The Obama administration had agreed to accept some of those being detained on humanitarian grounds after intervention by the United Nations.

At one point, Trump expressed admiration for Australia’s refusal to allow refugees arriving on boats to reach its shores, saying it “is a good idea. We should do that too.” In a remark apparently meant as a compliment, Trump told Turnbull, “You are worse than I am.”

But the conversation rapidly deteriorated.

“I hate taking these people,” Trump said. “I guarantee you they are bad. That is why they are in prison right now. They are not going to be wonderful people who go on to work for the local milk people” — an apparent reference to U.S. dairy farms.

Turnbull tried to salvage the deal , noting that the detainees were economic refugees who had not been accused of crimes. He explained that they were being denied entry into Australia because of a policy aimed at discouraging human smuggling.

“There is nothing more important in business or politics than a deal is a deal,” Turnbull said. “You can certainly say that it was not a deal that you would have done, but you are going to stick with it.”

Trump only became angrier, saying the refugees could “become the Boston bomber in five years.”

“I think it is a horrible deal, a disgusting deal that I would have never made,” Trump said. “As far as I am concerned, that is enough Malcom [sic]. I have had it.”

Turnbull tried to turn to Syria and other subjects. But Trump refused. The call, which began at 5:05 p.m., ended 24 minutes later with Turnbull thanking the still-fuming Trump for his commitment.

“You can count on me,” Turnbull said. “I will be there again and again.”

“I hope so,” Trump said before saying thank you and hanging up.

Julie Tate contributed to this report.

Read more:

8 jaw-dropping lines from Trump’s phone calls with Mexico and Australia

Does Trump actually know what happened last November?