Spain’s prime minister Pedro Sánchez declared that his country and the EU as a whole were in “crisis” after a record-breaking number of migrants entered Spanish territory from Morocco.

Spain deployed the army to help patrol the border of its north African enclave of Ceuta, after about 6,000 people, including an estimated 1,500 children, entered from Morocco on Monday — the biggest number of migrants recorded arriving in a single day in modern Spanish history.

Many swam or used makeshift boats to get into the 18.5 sq km coastal territory, which borders Morocco and is guarded by a six-metre fence. At least one person drowned.

The influx occurred after Morocco scaled down policing of the frontier following a diplomatic rift over Western Sahara, a territory claimed by Rabat but not recognised as Moroccan territory by Spain, the former colonial power.

“We are going to re-establish order in the city and our borders with maximum speed,” Sánchez said in a national address on Tuesday. “This sudden arrival of irregular migrants represents a crisis for Spain and Europe.” In a show of concern, he arrived in Ceuta later in the day.

EU leaders came out in support. Ursula von der Leyen, European Commission president, tweeted that “EU stands in solidarity with Ceuta & Spain” while Charles Michel, head of the European Council, pledged “all of our support . . . Spain’s frontiers are the EU’s frontiers.”

Morocco’s apparent use of migrants to exert pressure on Spain follows years of deploying a similar policy on a smaller scale, when it alternately loosened and tightened migration controls to influence policy in Madrid and the EU.

Ilke Toygur, an analyst at the Elcano Royal Institute in Madrid, compared it to tactics previously used by Turkey. “[President Recep Tayyip] Erdogan has long weaponised refugees on the borders as a source of pressure and you can see other countries could want to use similar tactics for special treatment of their own,” she said.

Morocco is also deeply unhappy with Spain’s decision to provide medical treatment to Brahim Ghali, head of the Polisario Front, which has long fought for the independence of Western Sahara. Ghali is being treated for Covid-19.

Rabat claims sovereignty over the desert region, which is roughly the size of the UK. A 30-year ceasefire with Polisario broke down at the end of 2020.

After the Trump administration recognised Moroccan sovereignty over Western Sahara in December — in return for Morocco’s normalisation of ties with Israel — Rabat has looked for EU countries to follow suit. Spain does not recognise the republic set up by Polisario or Morocco’s claims over Western Sahara. A UN plan to hold a self-determination referendum in the territory has been stalled for decades.

Nasser Bourita, Morocco’s foreign minister, said this month that Spain risked undermining relations, adding that Morocco refused to be “the policeman” of the EU on migration.

In a reference to Ghali’s hospitalisation in Spain, Karima Benyaich, Morocco’s ambassador in the country, told the Europa Press news agency on Tuesday that actions have consequences “and that has to be faced”.

But in an earlier radio interview, Arancha González, Spain’s foreign minister, said Ghali’s hospitalisation was “simply a humanitarian response to a request for humanitarian aid for someone with very fragile health”.

She added: “I can’t imagine that anyone would voluntarily put the lives of young people and minors at risk in the sea, as we have seen in last few hours in Ceuta . . . in response to a humanitarian action.”

The number of people that arrived on Monday is unprecedented for Spain and Ceuta, an enclave of 85,000 people. At the high point of a previous wave of migration, about 2,200 people arrived in the Canary Islands on a weekend last November.

The Red Cross in Ceuta told Spain’s national broadcaster it was “absolutely overwhelmed”, as videos indicated Moroccan authorities were doing little to prevent people from swimming into the Spanish territory.

Fernando Grande-Marlaska, Spanish interior minister, said on Tuesday Spain had already returned 2,700 people to Morocco. But television footage showed people continuing to make the crossing.