A week after the death of 23 migrants in a mass rush to the Spanish exclave of Melilla, protests have broken out in Spain and Morocco.

In Spain, thousands of demonstrators rallied in cities including Madrid, Barcelona, ​​Málaga, Vigo and San Sebastián and in Melilla itself on Friday to protest Spanish migration policies and the "militarization of borders".

In the capital Madrid, several hundred people took up the motto of the US anti-racism movement Black Lives Matter (the lives of black people matter).

They chanted "No one is illegal" and held up signs that read "Kill borders."

In Morocco, dozens of people gathered in front of the parliament in the capital Rabat.

"We demand an end to the EU-funded migration policy, the opening of an independent investigation and the return of the bodies to the families," said activist Mamadou Diallo.

The death of the migrants in a mass attack on the Melilla border fence had caused international outrage.

About 2,000 migrants, mainly from South African countries, tried to cross the border between Morocco and the Spanish exclave on Friday last week.

At least 23 migrants were killed.