More than a hundred people stormed the fence between Morocco and the Spanish enclave of Melilla on Thursday, officials said, in the latest attempt by migrants to breach the border.
The early-morning surge of 500 people "ended with 140 immigrants of sub-Saharan origin entering national territory," according to a statement from Spanish officials in the city.
Some who did not make it to Spanish soil were caught in the border zone, where they stayed for a number of hours shouting "freedom!", before later being arrested by Moroccan police, according to local media.
Six migrants and three police officers were injured, according to the statement, with some of those trying to jump the fence setting fire to their clothing "to throw at the agents".
Another group of around 200 people made a further attempt to cross the border a few hours later but were stopped by border guards.
Melilla, on Morocco's northern coast, provides one of only two land borders between the European Union and Africa, along with another Spanish territory, Ceuta, to the west.
Both have seen a flood of illegal border crossings by African migrants seeking a better life in Europe.
In March, 1,000 people tried to jump the triple-layer fence separating the city from Morocco, with half of them getting through - the biggest such crossing in nearly a decade.
In February, 15 migrants are believe to have drowned in Moroccan waters while trying to swim to Ceuta from a nearby beach.
Rights groups and witnesses accused Spanish security forces of firing rubber bullets at the migrants in the water, although the government denied its forces had targeted the migrants directly.
The territories, which sit across the Mediterranean from Spain, are a draw from migrants who do not want to make the treacherous journey to Europe by water.
Depending on treaties with the immigrants' countries of origin, some migrants who make it to Spanish territory are repatriated.
But the recent influx is putting pressure on Spain with a temporary immigration centre in Melilla, designed for 480 people, now holding 1,900 -- many of them in tents.
Spanish Prime Minister Mariano Rajoy has urged the European Union to provide more money and resources to help manage the border.
Spain is also boosting security. In late April, the government agreed to spend 2.1 million euros ($2.9 million) to try to stem illegal border crossings.