Israel’s president has had to apologise to Mexico on behalf of Israel’s prime minister, after Benjamin Netanyahu sent a tweet commending Donald Trump’s decision to build a wall along the U.S-Mexican border.

President Reuven Rivlin was forced to save his country’s blushes and mend relations with the Central American state after Netanyahu said walling off Mexicans was “a great idea”.

Aping Trump’s favourite form of online communication, Israel’s prime minister tweeted: “President Trump is right. I built a wall along Israel’s southern border. It stopped all illegal immigration. Great success. Great idea.”

Mexican leaders reacted angrily, and demanded an apology from Netanyahu, which was not forthcoming, precipitating Rivlin’s intervention.

He told his Mexican counterpart Enrique Peña Nieto that he was “sorry for any hurt caused as a result of this misunderstanding, but we must remember that we are talking about a misunderstanding. I am sure that we can put the issue behind us”.

It emerged this week that Israeli security company Magal, which built the wall around Gaza, was pitching for work on the construction of Trump’s border barrier, citing its success in keeping Israel safe.