MARRAKESH, Morocco — Protests erupted across Morocco over the weekend after the death of a fish vendor who, according to witnesses, was crushed by a compactor after he jumped into a garbage truck to retrieve his merchandise.

Grainy images of the man, identified in news accounts as Mouhcine Fikri, 31, circulated after his death on Friday night, in the northern port city of Al Hoceima. The city immediately erupted in protests, which spread on Sunday to cities like Marrakesh and Rabat, the capital.

King Mohammed VI of Morocco ordered the Interior Ministry to conduct “a careful and thorough investigation,” and to bring charges against anyone who had broken the law, the state-run Maghreb Arabe Presse news agency reported on Sunday.

According to news accounts, Mr. Fikri and several friends dived into the garbage truck after the authorities confiscated his merchandise, around $11,000 worth of swordfish, a protected species in Morocco. As the compactor started operating — it was not clear why — the friends jumped out, but Mr. Fikri was stuck inside.