German Foreign Minister Johann Wadephul called on the European Commission to make protecting the European Union's external borders an "absolute priority" after tens of thousands of migrants reached the Spanish enclave of Ceuta from Morocco.

"The situation in Ceuta over the past few days was an absolute stress test, which we passed," Wadephul told the Bild tabloid in remarks published on Saturday, adding that the events had nevertheless exposed Europe's vulnerabilities.

"I therefore expect the European Commission to make the protection of the external borders an absolute priority so as not to further endanger the Schengen system of open internal EU borders," he said.

Wadephul said effective migration policy depended on cooperation with countries outside Europe.

"To control illegal migration, we need partners outside Europe, as in this case Morocco," he said, adding that Spain and Morocco had managed to resolve the crisis quickly together, which he welcomed.

An estimated 50,000 to 60,000 people reached Ceuta from Morocco within a short period, and at least 67 people died attempting the crossing. Rescue teams continued searching the sea on Saturday.

Almost all of the migrants have since returned to Morocco, according to the Spanish government. Faced with little prospect of travelling onward and a lack of accommodation and basic supplies, many became disillusioned and voluntarily returned, Spanish newspaper El País reported.