The move came in protest at what the kingdom described as Germany’s ‘destructive attitude’ on the Western Sahara issue.
Spain has sent 2,700 people back to Morocco, out of the more than 6,000 who swam from the North African country into the Spanish enclave of Ceuta over the past two days.
Interior Minister Fernando Grande-Marlaska confirmed the move on Tuesday, adding that Madrid has sent 200 extra police to Ceuta to reinforce the 1,200 officers currently guarding the border with Morocco.
Spain earlier deployed troops in armoured personnel carriers on a beach near the border in a bid to prevent more refugees and migrants from entering its enclave, which is in North Africa.
Soldiers will patrol the border along with Spanish police, an interior ministry source told Reuters.
“This starts immediately,” the source said.
A spokesman for Ceuta’s government delegation said soldiers will also work with the police in sensitive locations within the enclave to maintain order on the streets.
In addition to the 6,000 people who swam to the border – a number which comprised mostly men but included some women and children, hundreds more tried to reach Spain’s other north African enclave of Melilla.
Most of those who made the perilous journey to Ceuta arrived on Monday, marking a record single-day high for crossings. About 1,500 children were among those to enter the territory.
One person died in the attempt, a Spanish government delegation spokesman said.
Spain does not grant Moroccans asylum status.
It only allows unaccompanied children to legally remain in the country under the government’s supervision.
More people reached Ceuta on Tuesday, although fewer than the day before due to the heightened vigilance on the Spanish side of the border.
Juan Jesus Vivas, the territory’s president and a member of the right-wing main opposition People’s Party, described the development as an “invasion”.
“We are not able to calculate the number of people that have entered,” he told Cadena SER radio.
“The army is in the border in a deterrent role, but there are great quantities of people on the Moroccan side waiting to enter,” Vivas told Cadena SER radio.
Footage published by El Faro de Ceuta, a local newspaper, showed people climbing the rocky wall of the breakwaters and running across the Tarajal beach, in the southeastern end of the city.
Other videos verified by The Associated Press showed long rows of young men lining up at the gates of a warehouse managed by the local Red Cross, waiting to be registered by Spanish Civil Guard officers.
Grande-Marlaska, the interior minister, said more people would be returned because Morocco and Spain signed an agreement three decades ago to send back all those who swim into the territory.
Meanwhile, the local authorities in Melilla said more than 300 people had tried to cross the double fence barrier into the territory before dawn on Tuesday, with 86 succeeding.
The developments came at a time of high tension between Madrid and Rabat and prompted Spanish Prime Minister Pedro Sanchez to cancel a trip to Paris, scheduled for later on Tuesday, where he was to attend an Africa financing summit.
Spain and Morocco are at odds over Madrid’s decision to allow in for medical treatment the chief of a rebel group that fights for the independence of Western Sahara.
The disputed territory has been under Moroccan control since 1975.
Vivas, the Ceuta president, suggested that Morocco may have loosened its controls on migration, prompting the sudden surge in arrivals, after Spain in April gave compassionate assistance to Brahim Ghali.
Ghali is the head of the Polisario Front, an Algeria-backed breakaway movement that seeks to establish an independent state in the Western Sahara region and has periodically engaged Moroccan armed forces.
The Spanish government itself officially rejects the notion that Morocco is punishing Spain for a humanitarian move.
The European Union stepped in on Tuesday, with commissioner for home affairs Ylva Johansson describing the crossings as “worrying”.
“The most important thing now is that Morocco continues to commit to prevent irregular departures and that those that do not have the right to stay are orderly and effectively returned,” she said. “Spanish borders are European borders.”
Ceuta and Melilla have the European Union’s only land borders with Africa, making them popular entry points for those seeking a better life in Europe.
Every year, thousands of people risk injuries or death while trying to reach the territories by jumping over fences, hiding inside vehicles, or swimming around breakwaters that extend into the Mediterranean Sea.
A 10-metre (32-foot) double fence surrounds the 8km (5 miles) of Ceuta’s southwestern border with Morocco, with the rest of the tiny territory facing the Strait of Gibraltar and the European mainland across the Mediterranean Sea.
More than 100 young Moroccans swam into the Spanish territory at the end of April, most of whom were returned to their country in less than 48 hours, after being confirmed to be adults.