Israeli Prime Minister Benjamin Netanyahu and then-presidential candidate Donald Trump meet in New York in 2016. (Kobi Gideon/Government Press Office handout via Reuters)

JERUSALEM — On Saturday evening, Israel's prime minister tweeted his praise of President Trump's decision to build a wall along the U.S. border with Mexico.

“President Trump is right,” Benjamin Netanyahu wrote. “I built a wall along Israel's southern border. It stopped all illegal immigration. Great success. Great idea.” He accompanied the tweet with emoji flags of Israel and the United States.

https://twitter.com/netanyahu/status/825371795972825089

A few hours later, Trump retweeted Netanyahu's praise.

Mexico wasn't pleased.

In Israel, the opposition pounced.

Yair Lapid, the leader of the Yesh Atid (“There is a Future”) party, wondered aloud, “Don't we have enough troubles of our own?”

In his electronic missive, Netanyahu was referring to the three-year-old fence Israel constructed along the entire length of its once-porous land border with Egypt in the Sinai Peninsula. Before the fence was erected, tens of thousands of economic migrants and war refugees from Africa — mostly from Eritrea and Sudan, dubbed “infiltrators" -- poured into the Jewish state. (Israel is currently trying to kick them out).

The sensor-packed steel barrier, completed in 2013, stopped illegal entry cold. It was a success. More than 10,000 Africans arrived in 2012 at the peak of the wave; today, almost no one attempts the trip.

The fence also shut down human traffickers in Egypt's Sinai who had become increasingly sadistic, with desperate wayfarers describing how they were imprisoned in “torture camps” where the Bedouin smugglers raped women and burned captives with molten plastic to extort relatives to send money to free them.

Today, some of those same smugglers belong to armed groups that have pledged allegiance to the Islamic State.

In an interview with Fox News on Thursday, Trump called a beefed-up barrier on the United States' southern border “good for the heart of the nation in a certain way, because people want protection, and a wall protects. All you’ve got to do is ask Israel. They were having a total disaster coming across, and they had a wall. It’s 99.9 percent stoppage.”

It was not clear which wall Trump was referring to. In addition to border fences facing Lebanon, Syria, Jordan and Egypt, Israel also has an internal security fence — with remote-controlled machine guns — along the periphery of the Gaza Strip, as well as separation barriers in the West Bank to keep Palestinians, and Palestinian terrorists, out of Israel.

Hours after Netanyahu's tweet, his office issued a clarification: “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.”

Israeli Foreign Ministry spokesmen followed up with more tweets.

As we said, Mexico wasn't happy with what it saw as Israel's clear endorsement of the wall.

Mexico's 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.”

“Mexico is a friend of Israel and should be treated as such by its prime minister,” Mexico City cautioned, adding that Foreign Minister Luis Videgaray had expressed “his deep affection for Israel in an event marking Holocaust Memorial Day on Friday.”

Netanyahu must have known he was inserting himself into the middle of a brawl.

Last week, Mexico's President Enrique Peña Nieto abruptly canceled his scheduled trip to the White House just hours after Trump insisted that Mexico would pay for the wall — or face 20 percent tariffs on its exports.

In Israel, reviews of Netanyahu's public diplomacy were mixed — and heads were scratched.

Was Netanyahu simply expressing Israel's positive experience with its own Sinai fence, as the Foreign Ministry argued? Or was he just pandering to Trump? Or might Israel be hopeful about selling its high-tech fence gizmos to the United States? The two nations already share technology related to detecting tunnels. Israel — under threat from Hezbollah in Lebanon, Hamas in Gaza and ISIS-linked forces in Sinai and Syria — is a world-leader in wall building. When a new section of barrier along the Jordan's southern border is complete, Israel will have succeeded in fencing itself in.

The Israeli lawmaker — and aspirant to the premiership — Yair Lapid called Netanyahu's wall tweet a “grave mistake.” He said the premier stuck his “crude foot” into a divisive issue that is tearing America apart. It was, he added, an “unnecessary declaration of war on Mexico and the Hispanics, and a divorce from the Democrats (including most U.S. Jewry). It doesn't matter what we think about the wall, don't we have enough trouble of our own?”

Lapid was hardly alone. In a remarkable tweet storm, former U.S. ambassador to Israel Daniel Shapiro, who served under President Barack Obama until a week ago, let loose on what he saw as Israeli meddling. The former American diplomat, who still lives in Israel as his children finish the school term, speculated that Trump may have pressured Netanyahu to offer his support for the wall along the Mexico border.

“But for what?” Shapiro asked. Canceling the Iran nuclear pact? Moving the U.S. Embassy from Tel Aviv to Jerusalem? Or allowing for a boom in construction in the Jewish settlements in the West Bank?