The death of at least 23 sub-Saharan migrants who were attempting to cross from Morocco to the Spanish enclave of Melilla is the worst tragedy of its kind, placing southern Europe's immigration controls and its relationship with North Africa under scrutiny.
Melilla is Spanish territory, but on the North African coast some 150km (90 miles) from the Spanish mainland. It and its sister city Ceuta are the only land borders between Africa and Europe.
Between 1,500 and 2,000 migrants who had been camping in the Moroccan mountains surrounding Melilla descended on the city's border last Friday, a number of them carrying sticks, hoping to scale the border fences and therefore reach Spanish territory.
In the chaos that followed, many of them were crushed between the six-metre-high fences and Moroccan border guards, who used tear gas and batons on the migrants.
While Moroccan authorities said that 23 migrants and two police were killed, local NGOs have reported a higher migrant death toll of 37, according to Caminando Fronteras. Dozens more were injured, with many reported to be in Moroccan hospitals.
A total of 133 migrants managed to reach Melilla, where they are being housed in the city's migrant temporary stay centre while their legal status is examined.
"The Moroccan police beat us and killed our friends and I don't understand why," Amir, a young man from Sudan who reached Melilla, told elDiario.es news site.
"The Moroccans hit me a lot," said Karin, another Sudanese man. "The repression was very heavy. It's never been like that before."
Video footage recorded shortly after the incident and posted on social media by the Moroccan Association for Human Rights (AMDH) showed several dozen migrants packed together on the ground near the border, with bodies piled on top of each other and bloodstains and articles of clothing nearby. Many of the migrants appeared injured while many others showed no signs of movement.
The dead migrants were due to be buried on Monday, although the AMDH said that their bodies had not been identified or undergone an autopsy.
This is the worst such tragedy that Spain's two North African enclaves have seen.
The most recent comparable incident was in 2014, when 15 migrants drowned while trying to swim round the border fence to Ceuta. A judicial investigation, into Spanish civil guards who had reportedly fired rubber bullets and teargas into the water nearby, was eventually shelved.
This time, the deaths have taken place against the backdrop of a controversial shift in relations between Spain and Morocco which is believed to have influenced border controls.
In March, it emerged that the Spanish government of Socialist Pedro Sánchez had altered its stance on the longstanding dispute over Western Sahara, favouring Morocco's claims to the territory, which is slightly larger than the United Kingdom, after decades of neutrality.
Rabat, Morocco's capital, had been pressuring Madrid to make such a change to its Western Sahara policy and the arrival of over 10,000 migrants in Ceuta over a 36-hour period in May 2021, with Moroccan border guards apparently doing nothing to stop them, was seen as part of this effort.
By siding with Morocco over the disputed territory, Mr Sánchez hoped to ensure the North African country's cooperation on migration, thus preventing a repeat of last year's Ceuta incident.
However, Spain's pivot on Western Sahara has angered Algeria, which backs self-determination for the territory, and critics say it has encouraged over-zealous policing of the border by Morocco.
"Spain must think again about a policy of externalising its borders and blackmail on the part of Morocco which creates so much violence and suffering," Pablo Echenique, spokesman for the Unidas Podemos party, the junior partner in the governing coalition, wrote on Twitter.
"When the dead are blond and have blue eyes, everyone sees things more clearly."
Unidas Podemos is among those who have called for a full investigation into the Melilla deaths.
In an editorial, El País newspaper drew a direct link between the improvement in bilateral relations with Morocco and that country's style of policing the border. The Spanish government, it said, "cannot ignore the way in which the [bilateral] accord is being fulfilled, given that there are signs of a serious violation of human rights."
In the immediate wake of the tragedy, Mr Sánchez put the emphasis on the migrants, describing it as "a violent attack which puts in doubt our territorial integrity".
And in an interview with La Vanguardia newspaper, published on Monday, the prime minister blamed people traffickers for the deaths.
"We regret the loss of human lives, in this case desperate people who were looking for a better life and who are victims and tools of mafias and criminals who organise violent actions against our border," he said.
He added: "I will never tire of expressing my support for the civil guard and the police. I also thank the Moroccan police for their work."
The EU's commissioner for Home Affairs, Ylva Johansson, described the Melilla tragedy as "deeply troubling" and echoed the Spanish prime minister's words by saying that a "forced, and violent, crossing can never be condoned".
The Spanish Catholic Church, meanwhile, appealed for the migration issue not to be used for political ends.
"They are not 'invaders', they are just human beings who are seeking to reach Europe, fleeing wars… and drought aggravated by the consequences of the war in Ukraine, lack of water and infestations caused by climate change," read a statement issued by the episcopal sub-commission for migration and human movement.