Spanish intelligence warned of the looming Ceuta migrant invasion, despite Prime Minister Pedro Sanchez’s claim the flood of over 70,000 migrants was a surprise.
Government documents revealed that Spain’s National Intelligence Service (CNI) warned Moroccan and Ceuta authorities that social media groups were encouraging the rush on July 29.
Around 72,000 migrants then invaded from Morocco into the Spanish exclave of Ceuta on July 30 and July 31.
Spain’s Socialist Prime Minister has insisted the flood of migrants was impossible to predict, blaming Russia and Israel for contributing to the mass crossing.
Although many migrants were returned to the north African country, thousands remain, with sexual assaults in the exclave spiking after the invasion.
The CNI sent a note to Moroccan authorities it had identified WhatsApp and Facebook groups promoting an attempt by migrants to reach the Spanish exclave by "both swimming and via the [border] fence".
"There are two different groups with a total of 180,000 followers. Just to give you an idea of the scale," the note read.
The intelligence service warned migrants planned to take advantage of Throne Day, a public holiday in Morocco on July 30.
A social media message shared by the CNI read: "Whoever wants to cross has the last chance on Throne Day at 8 the authorities will be distracted with the celebrations and parades."
The release of the documents has cast doubt on repeated Spanish Government claims the mass crossing could not be expected.
Locals in Ceuta have held near-daily protests against the thousands of remaining migrants, many of whom are living in makeshift camps or are sleeping on the city’s beaches and streets.
Spanish Foreign Minister Jose Manuel Albares has, however, insisted the documents showed there was no warning of the border rush.

"I am speaking as Spain’s Foreign Minister, within my remit and based on what I experienced that day," he told reporters on Wednesday.
"I was not aware of any information of any kind pointing to the magnitude of the avalanche."
Outraged Spaniards have called for Mr Sanchez to resign over his handling of the crisis.
Poling released earlier this week for Spain’s El Pais newspaper revealed two-thirds of Spaniards rated Mr Sánchez "bad" or "very bad" over his handling of the July 30 crossing.

"The response has been inadequate, late and, to top it all, has involved a complete dereliction of duty on the part of the Government," David Hernandez, 45, told Reuters at a demonstration.
"We cannot be second-class citizens, and our border must not be sidelined."
Nearly nine in 10 respondents blamed Morocco for causing the migrant flood, while 75 per cent blamed human trafficking rings and 74 per cent blamed social media.
Only 14.2 per cent of Spaniards felt the Government handled the crisis well.

Technology & Business Editor