MADRID — Human rights organizations in Spain and Morocco have called on both countries to investigate the deaths of at least 18 Africans and injuries suffered by dozens more who attempted to scale the border fence that surrounds Melilla, a Spanish enclave in North Africa.

Moroccan authorities said the casualties occurred when a “stampede” of people tried to climb the iron fence that separates Melilla and Morocco. In a statement released Friday, Morocco’s Interior Ministry said 76 civilians were injured along with 140 Moroccan security officers.

Local authorities cited by Morocco’s official MAP news agency said the death toll increased to 18 after several migrants died in the hospital. The Moroccan Human Rights Association reported 27 dead, but the figure could not immediately be confirmed.

The association also shared videos on social media that appeared to show dozens of migrants lying on the ground, many of them motionless and a few bleeding, as Moroccan security forces stood over them.

“They were left there without help for hours, which increased the number of deaths,” the human rights group said on Twitter. It called for a “comprehensive” investigation.

In another of the association’s videos, a Moroccan security officer appeared to use a baton to strike a person lying on the ground.

In a statement released late Friday, Amnesty International expressed its “deep concern” over the events at the border.

“Although the migrants may have acted violently in their attempt to enter Melilla, when it comes to border control, not everything goes,” Esteban Beltrán, the director of Amnesty International Spain, said. “The human rights of migrants and refugees must be respected and situations like that seen cannot happen again.”

APDHA, a human rights group based in the southern Spanish region of Andalusia, and a joint statement released by five rights organizations in Morocco also called for inquiries.

A spokesperson for the Spanish government’s office in Melilla said that around 2,000 people had attempted to make it across the border fence but were stopped by Spanish Civil Guard Police and Moroccan forces on either side of the border fence. A total 133 migrants made it across the border.