Women fill containers with water from a hose in Zagora, Morocco. Experts blame poor choices in agriculture, population growth and climate change for water shortages. (Issam Oukhouya/Associated Press)

They had traveled for miles to get to a remote village in drought-devastated Morocco for one reason: A local aid group was handing out flour.

The North African nation is in the grip of a severe drought, which is having a devastating effect on agriculture. And Sunday’s giveaway at the souk, or marketplace, was a chance for people to take food home to hungry families — if they could nab supplies before they ran out.

Videos and photos from the scene in Sidi Boulalam showed a press of people crowding the marketplace with no place to move.

It’s unclear what sparked a sudden stampede, but by the end, 15 people had been killed and many injured — a disaster in a small town sparked by a larger, ongoing disaster in the nation.

A witness told Sky News that there were several hundred people at the annual charitable distribution. “People shoved, they broke down the barriers,” the witness said. “The local authorities on the spot were overwhelmed. Even when there were people on the ground, people kept fighting for food.”

Just four officers were there to control the chaos, according another witness, a teacher named Manar Khouda.

As news of the tragedy spread, King Mohammed VI gave instructions that “all measures be taken to help the victims and their families,” according to the Associated Press. Mohammed will pay the cost of hospitalizing the injured and burying the dead.

The Moroccan government has long been searching for answers to the country’s drought, which has decimated two straight harvests.

Last year, wheat and barley production in Morocco was at its lowest level in a decade, according to World Grain, an industry magazine. The shortage was due to “inadequate rainfall during the planting season and the shortage of rain during the critical months of February and March.”

Wheat is a staple in Morocco and elsewhere in North Africa, according to the magazine. The average Moroccan consumes more than 440 pounds of wheat every year, one of the highest per capita rates in the world. The country irrigates only about 10 percent of its land, leaving it susceptible to Mother Nature’s whims.

Last year, during earlier stages of the drought, the king tried an age-old practice in a bid to save Morocco’s crops: prayer. On two Fridays in January, he led national rain prayers after normal worship ended.

But experts say the government needs agricultural solutions, not divine intervention: increased irrigation, better management of a growing population and improved purification of the water already in the country’s water pipes.

David Goeury, a geographer at Paris IV-La Sorbonne University, told the AP that a ban on water-intensive watermelon farming, for example, would help. Morocco is one of the region’s top exporters of the melon.

“The problem is that watermelon demands a lot of water and requires drilling. If the water table is overexploited, its water level will drop or the quality of the water will be altered because it will come into contact with saltwater,” Goeury said.

The lack of water is having a ripple effect on the country’s gross domestic product and security. Water, the Associated Press wrote, “is becoming a threat to national stability in the kingdom, seen as a steady force in a restive region and key ally with the West in the fight against terrorism.”

Charafat Afailal, the secretary of state in charge of water, said change is needed — soon. “The issue of water has always been a priority for Morocco, but today, after two years of drought, we have to move on to higher gear,” she said.

Read more:

‘My sons love hunting, I don’t’: Trump’s soft spot for elephants

White lawmaker warns black attorney she may ‘go missing’ if Confederate statues are threatened

WHO rescinds ‘goodwill ambassador’ appointment of Zimbabwe’s Robert Mugabe

A ‘violent psychopath’ escaped in Hawaii and flew to California — then got caught after hailing a cab