In the early hours of February 20, around 600 sub-Saharan African migrants passed undetected to the Ceuta border fence. Attacking the six-metre fence at multiple points, 359 made it through the heavily fortified perimeter, leaving Morocco and arriving in the Spanish north African enclave of Ceuta.

Three days earlier, almost 500 did the same - it the largest single penetration of the Ceuta border fence in a decade. News footage from the morning of February 20 shows hundreds of young men running through the city, and many later receiving treatment for injuries sustained from climbing the razor-wire fence.

They are exhausted but jubilant - they have finally made it to Spain.

They are only a fraction of the thousands of migrants in Morocco thought to be trying to reach Europe, and many will have spent months or even years waiting for this opportunity. Several men shout to the camera in Spanish: "Thank you, Spain."

In a span of three days, almost 900 people crossed the Ceuta border, leaving the small Spanish city's immigration centre at almost three times capacity.

In the entire previous year, around 1,000 people crossed the fences in Ceuta and fellow enclave city Melilla combined, according to the EU border agency Frontex. The sudden influx of migrants was likely Morocco sending its European neighbours a message, according to Spanish journalist Ignacio Cembrero.

"[The sudden migrant influx] was a reminder," Cembrero told Al Jazeera. "A way for Morocco to show that it controls immigration and holds the migrant pipeline in its hands."

EU-Morocco free-trade deals have come under attack from the Polisario Front, which lodged a series of lawsuits contesting the deals. In December 2016, the European Court of Justice nominally sided with Morocco, upholding agricultural accords.

Both Moroccan authorities and European authorities are aware that this [route] can be opened at any time, and that the more you close other options [...] there can become more pressure on the Western Mediterranean route. Ivan Martin, Pompeu Fabra University

The court decision, however, distinguished Western Sahara from Moroccan territory proper, which meant that goods there were not covered by the deal, thereby reigniting debate over the disputed region.

"The European Court of Justice decision was kind of a pyrrhic victory for Morocco," said Markus Gehring, lecturer in law at the University of Cambridge. "For the past […] 50 years, the parties agreed to disagree on the status of the Western Sahara and that is perhaps no longer a tenable situation."

On February 6, a week and a half before the mass Ceuta border crossings, Morocco's Minister of Agriculture Aziz Akhannouch called on Europe to find a solution to the trade dispute, warning that failure to do so would bring "grave consequences", both commercially and in migration policy.

"Any impediment to the application of this agreement is a direct attack on thousands of jobs on both sides in extremely sensitive sectors and a real risk of resumption of migratory flows that Morocco has managed and maintained through sustained effort," Akhannouch said in a press release.

Between 25,000 and 40,000 sub-Saharan African migrants are believed to be living in Morocco at the moment, many of whom intend to continue on to Europe, according to Ivan Martin of the Interdisciplinary Research Centre on Immigration at Pompeu Fabra University.

Morocco has worked closely with Europe to regularise migrants there and block them from continuing on towards Spain along the so-called Western Mediterranean Route to Europe.

"It is not in the headlines because it is more or less working in terms of migration control," Martín said. "Both Moroccan authorities and European authorities are aware that this [route] can be opened at any time, and that the more you close other options [...] there can become more pressure on the Western Mediterranean route."

The EU leadership is certainly eager to maintain good relations. The day after Akhannouch's warning, European Commission President Jean-Claude Juncker met the Moroccan minister to reaffirm the bloc's commitment to preserving free trade accords as they stand.

The EU is Morocco's most important trading partner, representing 55.7 percent of its trade in 2015. Sixty-one percent of Morocco's exports went to the EU in the same year. Yet, while Morocco's significance for the EU in trade is relatively minor for the bloc as a whole, Europe depends heavily on Morocco for cooperation on two of its most important concerns: migration and counterterrorism cooperation.

Within the next few months, the Polisario Front, according to its lawyer, will present a parallel case seeking to prevent an EU-Morocco trade agreement being applied to fish caught in Western Saharan waters. Several experts consulted by Al Jazeera predicted a similar outcome to the December case.

Morocco is offended that the EU courts lent legitimacy to the Polisario Front and considered it the sole representative of the Saharawi people - many of whom live in the Moroccan-administered Western Sahara - according to Samir Bennis, political analyst and editor-in-chief of Morocco World News.

"It is very likely that Morocco will stop its cooperation with the European Union on immigration if the EU takes no action to show its willingness to respect Morocco's concerns and its position regarding the Sahara," Bennis said. "The prospect of such a scenario would be disastrous for Spain, which would find itself dealing on a daily basis with an avalanche of immigrants trying to reach its territory through Ceuta and Melilla."

According to Bennis, Madrid has reached a tacit agreement with Rabat to support Morocco's claim to the Western Sahara in the EU in exchange for continued cooperation on controlling migration.

Yet border crossings continue. On March 7, 17 migrants in a raft were filmed crossing from Morocco to Spanish waters in broad daylight and in plain sight of numerous passersby. Moroccan police failed to intercept the vessel.

However, if Spanish Prime Minister Mariano Rajoy was concerned about what this impending diplomatic crisis could mean for his country and its reliance on Morocco for security and migration cooperation, he wasn't letting on. Cooperation with Morocco, he told the press, was "magnificent".

Cembrero, on the other hand, sees Europe and Morocco heading towards a political impasse with no obvious way out. And, should Morocco decide to flex its muscles over the Western Sahara issue, Spain will feel the brunt of its anger, most likely on the border fences in Ceuta and Melilla.

"[Spain] is the weak link of the European Union," Cembrero said. "I'm not saying it will happen within a few weeks, but I think we're entering a period of uncertainty."