Moroccan authorities said the disaster occurred after migrants attempted to storm a fence into the Melilla enclave, with some dying in a crush after what authorities called a stampede, and others falling from a fence. [nL1N2YB0KQ

The footage was posted on Facebook by the local branch of the Moroccan Association for Human Rights (AMDH) which works with migrants, including near Melilla. The AMDH branch head near Melilla, Omar Naji, told Reuters that the videos had been taken by the association's members and sympathisers.

Early on Friday morning some 2,000 migrants tried to storm the enclave fence into the Spanish territory sparking two hours of violent clashes with Moroccan and Spanish security forces, Rabat and Madrid said. About 100 people managed to cross.

Images posted by AMDH showed a dense concentration of people lying at an enclosed corner where two high metal fences meet at what appeared to be a frontier gateway.

Morocco said 18 people had died. AMDH said the death toll was 29. Spain said none had died on its side of the border. Moroccan and Spanish authorities said migrants had attacked border guards with weapons when trying to storm the fence.

Reuters has not been able to speak to any of the migrants who tried to cross.

Spain's North African enclaves of Ceuta and Melilla have become a magnet for mostly sub-Saharan African migrants trying to reach European soil.

The latest incursion comes just months after Spain changed its stance on Western Sahara to move closer to Morocco's position, ending a year-long row linked to the disputed territory and securing an agreement to strengthen cooperation on border control.

Spanish Prime Minister Pedro Sanchez on Saturday blamed "mafia" people traffickers for the violent and fatal border incursion in which scores of Spanish and Moroccan officers were also injured.

"It was an attack on the territorial integrity of our country," Sanchez told a news conference in Madrid.

CLASHES

One video clip posted by AMDH showed a large number of African migrants lying closely piled together, their bodies overlapping, many motionless and a few making feeble gestures, with Moroccan security forces standing over them in riot gear.

The same clip showed security forces pulling two bleeding and dazed-looking migrants past those lying on the ground. Another clip showed a Moroccan security officer striking one of several migrants lying prone next to a metal fence.

Sanchez paid tribute on Friday to officers on both sides of the border for fighting off "a well-organised, violent assault".

"The tactics of migrants (trying to get into Melilla) have changed. Before the used to spread along the whole length of the fence. Now they concentrate on the part where they think it is weakest," a Spanish police source said.

The source said the group of migrants who tried to storm the border had attacked frontier guards with sticks, knives and acid. "They all try to cross at the same time," the source said.

Eduardo de Castro, president of the regional government in Melilla, told RTVE television on Saturday: "This was a very violent assault but you have to weigh up the proportionality of (the reaction) by Morocco."

Images posted on social media by Spain's Guardia Civil officers' union - whose veracity Reuters was unable to verify - showed a large column of mostly young male migrants streaming through streets near the border.

Some appeared to be carrying sticks and throwing projectiles as puffs of smoke marked the air around them.

Authorities in Morocco said 140 members of its security forces were also injured, five seriously, though none had died.

A spokesman for the Spanish government in Melilla said no one had died on the Spanish side of the border, where 57 migrants and 49 police officers were injured.

"This is the most serious incident (on the border between Spain and Morocco) since 2014 when 15 people died," said Esteban Beltran, director of Amnesty International in Spain.

(Reporting by Ahmed Eljechtimi and Graham Keeley; Writing by Angus McDowall; Editing by John Stonestreet and David Clarke)