Spanish police cleared a large migrant camp from a beach in Ceuta on 4 October, moving about 3,000 people into temporary accommodation less than two weeks before King Felipe VI and Queen Letizia are due to visit the Spanish enclave in North Africa.

The migrants had been living for around two months in tents and makeshift shelters on Trampolin beach, according to a Spanish Interior Ministry spokesman quoted by Reuters.

Authorities said those moved from the beach would be housed temporarily while their cases were processed or they were given the opportunity to return to Morocco.

The operation followed an unprecedented mass crossing at the end of July, when more than 72,000 people entered Ceuta from Morocco. Most subsequently left, but Spanish authorities estimate that at least 10,000 remain in the territory.

The influx has put pressure on accommodation, public services and security in Ceuta, whose population is about 80,000. Thousands of migrants have spent weeks sleeping on beaches, pavements and other public spaces because reception facilities could not accommodate everyone.

Spanish police had already begun operations in September to move people from outdoor camps into temporary shelters. Reuters reported on 18 September that a newly constructed facility in the port had capacity for 1,700 adult men, while minors were being accommodated separately.

The continuing presence of migrants has also heightened local tensions. Residents demonstrated on 3 October calling for migrants to leave the enclave, Reuters reported.

The latest clearance comes shortly before King Felipe VI and Queen Letizia are expected to visit Ceuta on 13 and 14 October. It will be Felipe's first visit to the enclave since becoming king in 2014.

The planned trip follows months of political and diplomatic fallout from the July border crisis. Felipe said in late September that the mass crossing had created serious security, public-order and humanitarian pressures and argued that managing migration at the European Union's external borders should be a shared European responsibility.

Ceuta and Melilla are Spanish territories on Morocco's Mediterranean coast and form the European Union's only land borders with Africa.

Morocco has long claimed sovereignty over both territories, a position rejected by Spain. Madrid said in August that Spanish sovereignty over Ceuta and Melilla was not open to negotiation after Moroccan officials renewed their claims.

The July crossing intensified scrutiny of border controls between Morocco and Ceuta. Spanish Prime Minister Pedro Sánchez said in September that there was no firm evidence Moroccan authorities had deliberately orchestrated the influx, although he acknowledged that Moroccan police had failed to stop crossings for a period during the crisis.

Morocco has denied facilitating the movement and has blamed misinformation on social media, migrant-smuggling networks and confusion surrounding Spanish legal decisions.

The 4 October operation removes one of the largest remaining makeshift camps from a public beach, but thousands of migrants are still believed to be in Ceuta as authorities continue processing cases and arranging returns.