MELILLA, Spain — A thousand African migrants charged a barbed-wire border fence in Spain’s North African enclave of Melilla on Wednesday with many managing to get across, officials said, but dozens of others were beaten back by Moroccan and Spanish police.

During the pre-dawn border storming, cries of pain and noises of people being hit could be heard as police from both sides tried to prevent dozens of the sub-Saharan migrants from entering the city from Morocco.

A spokesman for the Interior Ministry said it had no indication that excessive force was used.

Spain’s North African city enclaves of Melilla and Ceuta are regularly targeted by large groups of African immigrants living illegally in Morocco who try desperately to cross into Europe in the hope of finding a better life.

On Friday, those who made it dashed through the streets to an official holding center were they were greeted by cheering migrants detained since previous crossings.

About 500 people in all managed to enter, bringing the total to some 2,400, the spokesman said. The holding center only caters for some 450 people and military tents have been erected to cater for the influx in recent months.

The spokesman commented on condition of anonymity because of ministry rules preventing staff from being identified.

After Spanish police and Moroccan officers forced the migrants remaining at the fence back into Morocco, two migrants climbed atop lamp posts at the border, refusing to come down. Spanish police used a crane to drag one of them down while the other eventually shinnied down voluntarily. They were both handed over to Moroccan officers on the spot.

The ministry official said several of the migrants who made it across were treated for light injuries such as cuts and bruises from falls.

Spain and Morocco stepped up border vigilance in February after 15 migrants drowned trying to enter Ceuta.