JERUSALEM (Reuters) - Israel’s president told his Mexican counterpart on Tuesday that he was “sorry for the hurt” over a tweet in which Prime Minister Benjamin Netanyahu appeared to praise U.S. President Donald Trump’s plans to build a wall on the Mexican border.

Slideshow ( 3 images )

In a tweet on Saturday that drew a rebuke from Mexico, the right-wing 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. He said his comments did not refer to ties between the United States and its southern neighbor.

The office of President Reuven Rivlin, whose post is largely ceremonial, issued a statement taking a more conciliatory line.

“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 Mexican President Enrique Pena Nieto.

Mexico’s foreign ministry acknowledged Rivlin’s apology.

The ministry said Pena Nieto told Rivlin the tweet had upset Mexico and its Jewish community, before adding that Mexico wanted to maintain its friendship and cooperation with Israel.

On Monday, Mexican Foreign Minister Luis Videgaray said he thought an apology would be “appropriate” for Netanyahu’s tweet while noting that Israel was a close friend of Mexico.

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 U.S.-Mexican relations for decades. Trump signed an executive order last week ordering construction of the wall.

Netanyahu, in public remarks on Monday, said that in his tweet 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 U.S.-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.

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

At the Tel Aviv conference, Netanyahu said that Israeli-Mexican ties “are much stronger than any passing disagreement or misunderstanding”.