Spain's top criminal court on Monday opened an investigation into July's deadly migrant surge into Ceuta, alleging it was facilitated by Morocco and pointing to failings by the African country's police.

More than 70,000 migrants crossed into Spain's north African territory from Morocco on July 30 and 31 in an unprecedented rush that left scores dead, most by drowning as they tried to swim around a breakwater.

Madrid's Audiencia Nacional court ruled it was competent to investigate as the influx involved "criminal conduct that was allegedly committed abroad and has seriously attacked Spain's territorial integrity".

The mass migrant flow "constitutes one of the characteristic methods of 'hybrid warfare' or the 'grey zone', with the aim of altering the life and rights of Spanish citizens" in Ceuta, investigating judge Maria Tardón wrote in her ruling.

The judge based her decision on a Spanish police report that highlighted "total permissiveness" by Moroccan security forces that facilitated the border breach.