Watch: 6,000 migrants in desperate swim from Morocco to Spain
Footage has captured armed police chasing crowds of migrants who had swum across the Moroccan border to enter the northern African Spanish enclave of Ceuta.
Spain has deployed troops to Ceuta to try and bring control to the situation, which Spanish prime minister Pedro Sanchez called a serious crisis for his country and Europe.
In video clips, police can be seen trying to round up migrants as thousands emerged from the sea, climbed rocks and scaled a border fence to enter the Spanish territory.
Dozens of migrants are also seen swimming and wading close to the beach, moving away from where troops stood.
Meanwhile, hundreds of others are seen standing on the Moroccan side of the fence that separates the Spanish enclave from Morocco.
Spain’s interior minister Fernando Grande-Marlaska said as many as 6,000 migrants, including about 1,500 minors, swam into Ceuta on Monday and Tuesday and that 2,700 had already been sent back to Morocco.
By Tuesday, the number of arrivals by sea had slowed, according to a Reuters reporter on the ground.
But soldiers in armoured vehicles were now guarding the beach.
Ceuta, which is located on the tip of Morocco across from Gibraltar, has long been a magnet for African migrants trying to reach Europe in search of a better life.
Speaking about the wave of migrants this week, Ceuta regional leader Juan Jose Vivas told 24H TV channel: “This is happening because of the absolute passivity of the Moroccan authorities."
He added that the situation was chaotic and it was now impossible to say how many migrants had entered.
"This transcends migration, we are talking about (Spain's) territorial integrity, sovereignty and borders," he added.
Watch: Spain sends army as thousands of migrants reach Ceuta
The surge comes at a time of increased tension between Spain and Morocco over the fate of Brahim Ghali, the leader of the Polisario Front, who is in hospital in Spain.
Morocco's Foreign Ministry had issued a strongly worded statement criticising what it said was Spain's decision to admit Ghali under a false identity without informing Morocco, warning of repercussions for relations between the countries.
The Polisario Front wants Western Sahara to be an independent state rather than part of Morocco. Algeria, Morocco's regional rival, backs the Polisario Front.
Rafael Calduch, professor of international law at Madrid's Complutense University, drew a link between the Ceuta situation and the tension over Ghali.
"The passivity of Moroccan police is a direct consequence of the hospitalisation of Ghali in Spain," he said, suggesting the northern African country is using the tactic of allowing migrants into Ceuta to put pressure on Madrid.
The northern African country also has a claim on Ceuta and another Spanish enclave, Melilla, which has also been a magnet for migrants crossing into Europe.
European Commission vice-president Margaritis Schinas tweeted that the enclave's frontier was a European border, expressing his "full solidarity with Spain" and calling for a European pact on migration and "strong protection of our borders."
Moroccan authorities did not respond to requests for comment on Tuesday.
Watch: 'Incredibly dangerous': Young children among migrants picked up by Border Force