Spanish prosecutors dropped their investigation into the deaths of at least 23 migrants at the border fence in Spain's North African exclave of Melilla in June.
The authority said on Friday that there was no evidence of criminally relevant behavior by Spanish security forces, as reported by the state TV broadcaster RTVE and other media.
On June 24, around two thousand migrants, mainly from South African countries including Sudan, tried to cross the border fence between Morocco and Melilla in order to get into the EU.
The young men died in a mass panic in a narrow courtyard in front of a border gate, which was bombarded with tear gas, and in the brutal intervention of Moroccan police officers that followed.
The death of the refugees in the mass rush to the Melilla border fence had caused international outrage.
Spain and Morocco have denied any responsibility for the people's deaths.
The prosecutor stressed that everything had developed very quickly and that the Spanish security forces had not been able to see the danger.
She also described the refugees as "constantly hostile and violent."
Spanish officials were unaware that people in the crowd needed medical attention.
Morocco also blamed neighboring Algeria for the deaths.
Algeria has shown a certain laxity in border controls, the Moroccan embassy explained.
Spain had distanced itself from this accusation.
Amnesty International had also made serious allegations against Spanish police officers and put the number of dead at at least 37. "We are talking about massive killings, enforced disappearances, torture, push backs (forced returns) and racism," said Amnesty Secretary General Agnès Callamard at a press conference in Madrid last week.
The director of the Spanish section of the human rights group, Esteban Beltran, specifically blamed Spanish officials for the tragedy.
According to the report, police officers threw stones at migrants and fired tear gas at them in closed rooms.
Spain's Interior Ministry dismissed the report, saying it contained "false allegations".
The Spanish government also stressed that these are tragic circumstances on the territory of another country, that is, Morocco.
According to Spain's Interior Minister Fernando Grande-Marlaska, Spanish police officers have observed the law and there have been no deaths on Spanish soil.
A media report, however, suggests a different version.
Melilla and the other Spanish exclave of Ceuta share the EU's only land border with Africa.
The areas are therefore regularly the destination of people who hope for a better life in Europe.