Around 2,000 migrants attempted to storm the border separating Spain's Melilla enclave from Morocco, the Spanish government said, raising an earlier estimate.

At least 130 migrants managed to enter Melilla, the Spanish government's local delegation said in a statement. It had said earlier that over 400 migrants had stormed the border.

Melilla and Ceuta, Spain's other tiny North African enclave, have the European Union's only land borders with Africa, making them a magnet for migrants.

The migrants, from sub-Saharan Africa, were "perfectly organised and violent", Spain's local delegation said.

Morocco deployed a "large" amount of forces to try to repel the assault on the border, who "cooperated actively" with Spain's security forces, the statement added.

In March this year, Spain ended a year-long diplomatic crisis by backing Morocco's autonomy plan for Western Sahara, going back on its decades-long stance of neutrality.

Spanish Prime Minister Pedro Sanchez then visited Rabat, and the two governments hailed a "new stage" in relations.

A view from the Spanish side shows the border between the Spanish enclave of Ceuta and Morrocco

The row began when Spain allowed Brahim Ghali, leader of Western Sahrara's pro-independence Polisario Front, to be treated for Covid-19 in a Spanish hospital in April 2021.

A month later, some 10,000 migrants surged across the Moroccan border into Spain's Ceuta enclave as border guards looked the other way, in what was widely seen as a punitive gesture by Morocco.

Moroccs has called for the Western Sahara to have an autonomous status under Moroccan sovereignty but the Polisario wants a UN-supervised referendum on self-determination as agreed in a 1991 ceasefire agreement.

Over the years, thousands of migrants have attempted to cross the 12-kilometre border between Melilla and Morocco, or Ceuta's 8km border, by climbing the fences, swimming along the coast or hiding in vehicles.

The two territories are protected by fences fortified with barbed wire, video cameras and watchtowers.

Claimed by Morocco, the two cities have long been a flashpoint in diplomatic relations between the Moroccan and Spanish governments, which insists both are integral parts of Spain.