Clashes erupted near Morocco’s border with the Spanish enclave of Ceuta on Wednesday as security forces tried to disperse would-be migrants.
Police and troops were deployed to Fnideq to block access to the border.
Dozens of mainly young men gathered in nearby square and clashes erupted when security forces tried to move them away.
Some of the men threw objects at the forces personnel and set fire to a makeshift barricade in the middle of the street.
Police moved back initially but later dispersed the group.
About 8,000 people have crossed into Ceuta from Morocco in the past two days in an unprecedented influx.
Most of them swam around breakwaters and across the border to reach the Spanish enclave in North Africa.
Over the decades, Spain has built a close relationship with Morocco to crack down on illegal border crossings, but also to increase economic ties and fight extremism.
But on Wednesday, its foreign minister said for the first time in public that Spain believed Morocco loosened its border control to retaliate for Spain having given medical assistance to the head of the liberation movement for Western Sahara, a disputed territory to Morocco’s south.