Prime Minister Benjamin Netanyahu on Saturday welcomed praise from Donald Trump for Israel’s security barrier, writing on Twitter that the US president “is right” about walls preventing illegal immigration.

Referring to a second barrier, the recently built fence along Israel’s border with Egypt, the prime minister said the measure had been a “great success” in keeping out migrants, who mainly came from African nations.

“President Trump is right. I built a wall along Israel’s southern border. It stopped all illegal immigration. Great success. Great idea,” Netanyahu wrote in English on Twitter, Trump’s preferred method of communication. The prime minister ended his tweet with emojis of the Israeli and American flags.

In an interview with Fox News on Thursday, Trump appeared to be touting 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, and it saw a dramatic fall in suicide bombings.

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

“The wall is necessary,” Trump said Thursday. “That’s not just politics, and yet it is 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.”

The barrier along Israel’s Egyptian border is not a concrete wall akin to the one Trump is planning to build on the US-Mexico border, but rather a system of wire fencing and sensors.

The president announced Thursday that he was going ahead with his plan for the border wall, which he maintained Mexico would pay for, despite the country’s insistence that it will not foot the bill. Mexican President Enrique Pena Nieto nixed his planned January 31 meeting with Trump, after the latter tweeted that the meeting should be canceled if Mexico wouldn’t pay for the construction.

African refugees sit behind a border fence after they attempted to cross illegally from Egypt into Israel as Israeli soldiers stand guard near the border with Egypt, in southern Israel, on September 4, 2012. (photo credit: AP/Ariel Schalit, File)

African refugees sit behind a border fence after they attempted to cross illegally from Egypt into Israel as Israeli soldiers stand guard near the border with Egypt, in southern Israel, on September 4, 2012. (AP/Ariel Schalit, File)

Israel built the Egyptian border fence in 2012, all but blocking illegal migration, and began extending a fence along its eastern frontier with Jordan. Since 2012, the Israeli government has requested that the migrants in the country leave, giving cash grants to those who depart for their homes or some other African country. The government also has detained thousands of migrants since 2013 in Holot, a detention facility adjacent to a prison on the Egyptian border.

African illegal migrants carry their belongings following their release from the Holot Detention Centre in Israel's Negev desert, on August 25, 2015. (AFP PHOTO/MENAHEM KAHANA)

African illegal migrants carry their belongings following their release from the Holot Detention Centre in Israel’s Negev desert, on August 25, 2015. (AFP/Menahem Kahana)

According to Israel’s Population, Immigration and Border Authority, more than 60,000 African migrants crossed into Israel illegally from Egypt between 2006 and 2012. The migrants, mostly from Eritrea, say they’re seeking asylum from a brutal dictatorship. Some 45,000 remained in the country as of 2015.

The government has viewed them as economic migrants looking for work and, with rare exceptions, has not recognized them as refugees.

Trump on Friday also signed an executive order temporarily banning entry to the US for all nationals from seven Muslim countries — Syria, Iran, Iraq, Sudan, Libya, Somalia and Yemen — as part of sweeping measures that also suspend all refugee arrivals.