MEXICO CITY, Feb. 01 (Xinhua) -- Israeli President Reuven Rivlin on Tuesday apologized to Mexico for its prime minister's controversial tweet, which favored the erection of a border wall between the United States and Mexico.

In a conversation with Mexican President Enrique Pena Nieto, "President Rivlin apologized for damaging Mexico and vowed to restore the ties of cooperation and friendship," the Foreign Affairs Ministry of Mexico said in a statement.

Over the weekend, Israeli Prime Minister Benjamin Netanyahu praised U.S. President Donald Trump's decision to erect a wall along the border to keep out illegal migrants and drug traffickers.

"President Trump is right. I built a wall along Israel's southern border. It stopped all illegal immigration. Great success. Great idea," Netanyahu tweeted Saturday.

The tweet sparked anger in Mexico, with the foreign ministry expressing "profound astonishment, rejection and disappointment over Prime Minister Netanyahu's message."

"Mexico is a friend of Israel and should be treated as such by its prime minister," the ministry said in a statement.

On Tuesday, at a public event, Netanyahu addressed the diplomatic kerfuffle, though he did not offer an apology.

"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, and I believe our ties are much stronger than any passing disagreement or misunderstanding," Netanyahu said.