Still, photos that emerged from the stampede left many taken aback on Sunday.

“The image speaks loudly about the precariousness people live in,” said Mehdi Lahlou, an economist and professor at the National Institute of Statistics and Applied Economics in Rabat.

“Many initiatives have failed because of the way projects were handled. Spending is not monitored,” Mr. Lahlou said. “In this particular case, it seems that the event was badly organized and the local authorities did not take the necessary measures to prevent this from happening.”

In a speech in October, Morocco’s king, Mohammed VI, assailed the governing elites, saying that the socioeconomic development projects had failed and that a sizable part of the population still lived at risk. “Today, Moroccans need a balanced and equitable development that guarantees dignity for all, a development that generates income and jobs and that especially benefits young people,” the king said.

The Essaouira region, a popular tourism hub, is also known for producing argan oil, which is used in beauty products. In the last decades, many cooperatives have been created to help local women benefit from the production of the oil.

Asma Chaabi, a member of Parliament from Essaouira, said the task of improving people’s lives was daunting.

“This is an area that is very rich in terms of natural resources,” she said. “But there is a lot of work that needs to be done in order to advance human development, especially when it concerns the youth and women.”

At the market on Sunday, many who were injured were taken to hospitals in Essaouira and Marrakesh. A witness cited by local news reports said the donor had been distributing flour, cooking oil and sugar when the stampede broke out.