US President Donald Trump cited Israeli Prime Minister Benjamin Netanyahu and Israel’s security barrier during a tense phone call with Mexican President Enrique Peña Nieto shortly after he took office, according to a transcript published Thursday.

Much of the conversation revolved around Mexico’s opposition to Trump’s plans to build a wall between the US and Mexico and have the Mexican government pay for it.

In the call, which took place a week after Trump was inaugurated, the president tells his counterpart: “You know, you look at Israel – Israel has a wall and everyone said do not build a wall, walls do not work — 99.9 percent of people trying to come across that wall cannot get across and more.”

“Bibi Netanyahu told me the wall works,” Trump said in a transcript of the call obtained by the Washington Post, which published it in full.

Building a wall on the US border with Mexico was a key Trump campaign promise, sparking tensions between the US and its southern neighbor and earning the then-candidate accusations of racism and xenophobia, specifically following comments he made on the campaign trail claiming that Mexico was sending “criminals, drug dealers, rapists, etc” across the border to the US.

Five days after he was inaugurated, Trump signed an executive order to begin construction on the wall, tweeting a day later that Mexico will pay for it.

The comment prompted Pena to cancel his trip to Washington to meet with Trump on January 31.

A day after the tweet, Netanyahu posted a tweet of his own appearing to praise Trump’s push for the Mexico wall, saying: “President Trump is right. I built a wall along Israel’s southern border. It stopped all illegal immigration. Great success. Great idea.”

The tweet sparked Mexico’s ire, with Mexican Foreign Minister Luis Videgaray demanding a clarification and an apology.

Netanyahu later appeared to backtrack, arguing that he was not commenting on US-Mexican relations, but simply referring to the “great success” of Israel’s border with Egypt, which the prime minister has said has been key to keeping out migrants, who mainly came from African nations.

US President Donald Trump signing an executive order on January 27, 2017 at the Pentagon in Washington, DC. (AFP Photo/Mandel Ngan)

US President Donald Trump signing an executive order on January 27, 2017 at the Pentagon in Washington, DC. (AFP Photo/Mandel Ngan)

While it was not clear which Israeli wall Trump was referencing when speaking with Pena, in a Fox interview days after the conversation, Trump appeared to tout Israel’s West Bank security barrier as an example of a successful deterrent to unlawful entry into a country.

Israel built the barrier — a combination of fence, concrete wall and sophisticated sensors — in response to the massive wave of deadly Palestinian terrorism that hit the country during the Second Intifada at the start of the millennium, with suicide bombers traveling the short distances into Israel to carry out murderous attacks. Israel saw a dramatic decline in suicide bombings after the barrier was constructed.

Illustrative: Israeli machines and workers build parts of the Israeli security barrier near the West Bank city of Beit Jala, outside Jerusalem, on April 17, 2016. (Wisam Hashlamoun/FLASH90)

Illustrative: Israeli machines and workers build parts of the Israeli security barrier near the West Bank city of Beit Jala, outside Jerusalem, on April 17, 2016. (Wisam Hashlamoun/FLASH90)

The barrier along Israel’s Egyptian border is not a concrete wall as Trump is planning to build on the US-Mexico border, but rather a system of wire fencing and sensors. It built the Egyptian border fence in 2012, all but blocking illegal migration, and began extending a fence along its eastern frontier with Jordan.

Mexican authorities have been particularly incensed with Trump’s promise to have Mexico pay for the wall being built.

In the call, Pena said such a proposal was “unthinkable” and that his government finds “this completely unacceptable for Mexicans to pay for the wall that you are thinking of building.”

He said the issue was a “critical point that has not allowed us to move forward in the building of the relationship between our two countries.”

In the conversation with Pena, Trump boasted of his victory in the 2016 presidential elections, falsely said he won a large percentage of Hispanic vote and informed Pena that he did not even initially want a meeting with Mexican officials to discuss changes to trade, border and immigration policies with Mexico.

Trump was referencing his son-in-law Jared Kushner’s meeting with Mexico’s FM Luis Videgaray on January 25, as the executive order on the wall was being rolled out.

In the call on January 27, Trump told Pena that the US has “the drug lords in Mexico that are knocking the hell out of our country. They are sending drugs to Chicago, Los Angeles, and to New York. Up in New Hampshire – I won New Hampshire because New Hampshire is a drug-infested den.”

Trump did not win New Hampshire in the 2016 election. He lost it to Hillary Clinton by a 0.3 percent margin.

“We are becoming a drug-addicted nation and most the drugs are coming from Mexico or certainly from the southern border,” Trump said in the call.

The president warned Pena that if Mexico continued to hold that it would not pay for the wall, “then I do not want to meet with you guys anymore because I cannot live with that.”

Pena countered that while he “recognized the right of any government to protect its borders as it deems necessary and convenient,” his position “has been and will continue to be very firm saying that Mexico cannot pay for that wall,” to which Trump said that Pena “cannot say that to the press.”

“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,” Trump said, urging Pena to stop publically saying Mexico would not finance construction of the wall and that he was “sure they can work something out that is good for both nations.”