More than 1,000 migrants tried to jump a high double fence between Morocco and the Spanish enclave of Ceuta on Sunday in a violent assault that saw one officer lose an eye.
A group of 1,100 people from sub-Saharan Africa trying to reach Europe stormed the border fence just after 4am (03:00 GMT) on New Year's Day in an "extremely violent and organised" way, said the central government's representative office in Ceuta.
None, however, managed to get through, but two who were badly injured and taken to hospital in Ceuta, the office said in a statement. A similar assault on December 9 saw more than 400 migrants enter the tiny enclave.
They tried "to force open some of the doors in the external fence, using iron bars, wire cutters and large stones, with which they assaulted Moroccan forces and [Spanish] Guardia Civil [police] agents," it added.
Five Spanish policemen and 50 members of the Moroccan forces were injured, including one who lost an eye, it said.
"From now on, those making such attempts will be presented before the competent judicial authorities, who will decree their expulsion from the kingdom [of Morocco] or heavier penalties, according the gravity of the act," Morocco's interior ministry said in a statement.
Ceuta and Melilla, another Spanish territory in North Africa, have the European Union's only land borders with Africa.
They are one of the entry points for African migrants seeking a better life in Europe, who get there by either climbing over the border fence, swimming along the coast, or hiding in vehicles.
On Monday, a French national was arrested for trying to board a ferry out of Ceuta with a camper van in which 12 Algerians were found hiding, "car sick and sweating", police said.
Separately, on Sunday, Spanish police said a Moroccan woman was arrested in Ceuta last week for trying to smuggle a 19-year-old migrant from Gabon across the border with Spain curled up inside a suitcase.
According to local authorities, of the 1,100 migrants who stormed the border Sunday, about 100 managed to climb up the external fence and stayed on top for hours.
Footage shot by the local Faro TV shows one man perched at the top of the six-metre high fence, sitting uncomfortably near rolls of barbed wire, his head hanging down onto his chest.
Eventually, as darkness turns to light, he slowly climbs down to a space between both fences and lies down as a Spanish policeman fetches him a bottle of water before taking him to an entry back into Morocco.
Separately, coastguards said they had rescued 52 people who were packed onto a small boat at sea south of Malaga, on Spain's southern coast.
2016 was the deadliest year ever for migrants in the Mediterranean, with almost 5,000 deaths, according to the International Organization for Migration.
Source: AFP news agency