The Spanish chief prosecutor ordered on Tuesday a probe to clarify the circumstances that led to the death of at least 23 migrants trying to cross into the Spanish enclave of Melilla last Friday amid clashes with Moroccan and Spanish security forces.
About 2,000 migrants took part in the attempt to storm a border post with about 100 managing to get across. Both Morocco and Spain have denied using excessive force.
"The State Attorney General's decision is based on the importance and seriousness of the events that took place, which could affect human rights and the fundamental rights of individuals, as well as the uniqueness and complexity of the investigation," the prosecutor office said in a statement.
Moroccan human rights council CNDH, a constitutional body independent of the government, has sent a fact-finding mission to look into the deadly incident.
Separately, the United Nations joined other human rights voices in calling for an independent probe into the clashes.
The incident has sparked political outrage in Spain with several parties demanding answers from the government after the country's prime minister, Pedro Sanchez, thanked the Moroccan security forces for their help controlling the border.
On Monday, Moroccan authorities began prosecuting 65 of the migrants involved in the organization of Friday's mass attempt.
A Moroccan border control chief blamed trafficking gangs for the violence on Monday which he said took a "quasi-military character", adding that "attackers had militiamen profiles and included former military men from countries destabilized by war and conflict," state news agency MAP quoted him as saying.
Since 2017, Morocco has stopped 360,000 illegal migrants from crossing the border into Spain, around 26,000 of them this year alone, he said.
The consequences of the pandemic, the war in Ukraine and the food crisis have exacerbated the migration challenge.