Mexico’s Foreign Ministry called out Israel for a tweet by Prime Minister Benjamin Netanyahu seen as supporting U.S. President Donald Trump’s plan to build a wall with Mexico to keep out illegal immigrants.

“President Trump is right,” Netanyahu said on Twitter on Saturday morning. “I built a wall along Israel’s southern border. It stopped all illegal immigration. Great success. Great idea.” The tweet featured American and Israeli flag icons. The White House later retweeted the message.

“The Foreign Ministry expressed to the government of Israel, via its ambassador in Mexico, its profound astonishment, rejection and disappointment over Prime Minister Netanyahu’s message on Twitter about the construction of a border wall,” the Mexican Foreign Ministry statement said.

“Mexico is a friend of Israel and should be treated as such by its Prime Minister.”

The statement noted that Mexican Foreign Secretary Dr. Luis Videgaray Caso on Friday visited the Israeli embassy to commemorate International Holocaust Remembrance Day. “Mexico and Israel share the historic rejection of racism and xenophobia, and Mexico will continue to work closely with Israel to combat any form of discrimination in the world,” the statement said.

It also expressed Mexico’s respect and admiration for the Jewish people, and especially the “great Mexican Jewish community, which contributes every day to the construction of a freer, fairer and more prosperous Mexico.”

The Central Committee of the Jewish Community in Mexico issued a statement saying it “forcefully rejected” Netanyahu’s tweet.

Following Mexico’s criticism of Israel, the Prime Minister’s Office and Israel’s Foreign Ministry issued a statement to clarify the original tweet.

“The prime minister was addressing Israel’s unique circumstances and the important experience we have and which we are willing to share with other nations. There was no attempt to voice an opinion regarding U.S.-Mexico ties,” the statement said.

Israel built a fence along its border with Egypt in 2013 with the aim of keeping out migrants from Africa and defending against terrorist activity in the Sinai Peninsula. The length of the Israel-Egypt border is about 165 miles. The length of the Mexico-U.S. border is nearly 2,000 miles. Israel has also deported African migrants, including paying them to leave for third countries. The Israeli government also has detained thousands of migrants since 2013 in the Holot detention center.

Trump’s executive order last week to start building the wall – fulfilling one of his campaign promises – has already stirred controversy, leading to a diplomatic crisis with Mexico. Enrique Pena Nieto, Mexico’s president, canceled a planned meeting with Trump subsequent to the order.

Defending the order last week, Trump cited Israel’s experience. “A wall protects,” Trump told Sean Hannity on Fox News on Thursday, without specifying which of Israel’s security barriers he was referring to. “All you have to do is ask Israel. They were having a total disaster coming across and they had a wall. It’s 99.9 percent stoppage.”