Israel's defence minister left Morocco Thursday ending an unprecedented visit following last year's normalisation deal, with the countries signing a security agreement as part of deepening ties that have angered neighbouring Algeria.
Before taking off, Gantz, the first Israeli defence minister to visit Morocco, said his trip had given a boost to "the security of the State of Israel and to its foreign relations".
On Wednesday, Gantz and Morocco's minister in charge of defence administration, Abdellatif Loudiyi, signed a memorandum of understanding advancing security and military cooperation.
The pact in particular makes it easier for Morocco to purchase hi-tech goods from Israel's defence industry. Gantz's ministry approves all security product exports.
Israel and Morocco normalised ties last year in an agreement brokered by former US president Donald Trump.
In return for recognising Israel, the Trump administration recognised Morocco's sovereignty over the disputed territory of Western Sahara.
Morocco controls most of Western Sahara and considers the former Spanish colony part of its sovereign territory.
Algeria backs Western Sahara's Polisario Front independence movement.
Algeria cut diplomatic ties with Morocco in August, citing "hostile actions" -- a charge denied by Rabat.
A top Algerian official said Thursday that Gantz's visit to Morocco had "targeted" his country.
"The enemies are mobilising more and more to undermine Algeria", said Senate president Salah Goudjil, the most senior official in Algeria after the country's president.
Earlier this month, Algiers accused Rabat of killing three Algerian civilians on a desert highway through the Polisario-held area of Western Sahara in a strike on their trucks, raising fears of an escalation.
And Polisario head Brahim Ghali said last week the movement had decided to step up military operations.
An article in Algeria's state newspaper El Moudjahid on Thursday sought to highlight anger among ordinary Moroccans over Gantz's visit, saying it "ingnited the fury" of Palestinian advocates in the kingdom.
Palestinians were outraged by the series of Trump-brokered normalisation deals that saw Morocco, the United Arab Emirates and Bahrain establish full diplomatic ties with the Jewish state.
Sudan followed suit in January but has yet to build relations.
The Palestinians have urged the Arab world to maintain its stand against recognising Israel until it agrees to a peace deal establishing a Palestinian state with its capital in Israeli-annexed east Jerusalem.
Hamas, the Palestinian Islamist group that controls Gaza, on Thursday condemned Gantz's Morocco trip.
"Normalising ties with the occupation is a stab in the back of the Palestinian people that encourages it to go ahead with crimes and violations against Palestinians," a Hamas statement said.
Israel previously occupied Gaza and has maintained a blockade on the territory since 2007, the year Hamas took power. Israel has occupied the West Bank since the 1967 Six-Day War.