Israel’s president has told his Mexican counterpart that he was “sorry for the hurt” over a tweet in which the prime minister, Benjamin Netanyahu, appeared to praise Donald Trump’s plans to build a wall on the US-Mexican border.

In a tweet on Saturday that drew a rebuke from Mexico, the rightwing Netanyahu wrote: “President Trump is right. I built a wall along Israel’s southern border. It stopped all illegal immigration. Great success. Great idea.”

Netanyahu had earlier sidestepped Mexico’s demand for an apology and echoed previous Israeli explanations – rejected as insufficient by Mexico’s foreign minister on Monday – of his remarks on Twitter, saying his comments did not refer to ties between the US and its southern neighbour.

President Reuven Rivlin’s office issued a statement quoting him as taking a more conciliatory line, however.

“I am sorry for any hurt caused as a result of this misunderstanding, but we must remember that we are talking about a misunderstanding, and I am sure that we can put the issue behind us,” Rivlin was quoted as telling the Mexican president, Enrique Peña Nieto.

Rivlin’s post as president is largely ceremonial and the long statement appeared to stop short of the full apology that Mexico had called for.

“I think an apology … would be appropriate in this case,” the foreign minister, Luis Videgaray, said following Netanyahu’s tweet, while noting that Israel was a “close friend” of Mexico.

Netanyahu, in public remarks on Monday, said he had been referring to Trump’s praise for the barrier Israel constructed along the Egyptian frontier, a fence with electronic sensors that has largely halted the influx of African migrants.

“I did point out the remarkable success of Israel’s security fence. But I did not comment about US-Mexico relations. We’ve had, and will continue to have, good relations with Mexico,” Netanyahu said in English at a cybersecurity conference in Tel Aviv on Tuesday.

Trump’s planned border wall, which he says will keep out illegal immigrants, along with his threat to impose punitive taxes against Mexico to rebalance trade, has brought about the worst crisis in bilateral relations for decades.

Political commentators and opposition politicians in Israel said Netanyahu’s tweet had needlessly thrust Israel into the US-Mexican feud.

At the Tel Aviv conference, Netanyahu said that Israeli-Mexican ties “are much stronger than any passing disagreement or misunderstanding”. He voiced confidence that a “long, fruitful and very friendly relationship” with Peña Nieto would continue.