Tensions between Morocco and Spain rose last week with the arrival of more than 8,000 migrants in Spain through the border with the city of Ceuta.
The mass arrival of migrants that overwhelmed Spanish border guards occurred after Spain allowed for Brahim Ghali, who played a key role in the fight for the independence of Western Sahara, to be treated medically in the country.
But last Wednesday, Morocco put an end to the migratory exodus as Reuters reported that Ghali had been handed a June 1 summons to war crime court in Spain.
Spanish Prime Minister Pedro Sánchez said on Monday that Spain is an ally of Morocco at the EU's council summit.
Others took a harsher stance.
"No one can intimidate or blackmail the European Union," EU Commissioner Margaritis Schinas responded last week, stating that there had already been "some attempts by third countries in the last 15 months" to use the migration issue against the bloc.
Moroccan Human Rights Minister El Mustapha Ramid said in a Facebook post that Spain knew "that the price of underestimating" its country "was very expensive."
Minister of Foreign Affairs Arancha González Laya told public radio that the country was treating Ghali in hospital for humanitarian reasons without "aggression" despite being aware that the Western Sahara conflict is a subject "of enormous sensitivity for Morocco".
Western Sahara is a disputed territory that was previously under Spanish control but now is largely controlled by Morocco. Ghali was a leader of the Polisario Front, which is backed by Algeria and has long fought for its independence.
Experts say this is not the first time that Morocco has used access to Europe to pressure the bloc for a diplomatic or political objective.
Is Morocco using immigration as a bargaining chip with the EU?
"Morocco often resorts to the use of illegal migration as leverage against Spain and the EU. It has been used in the past, notably when Morocco was engaged in a free trade dispute with the EU," says Mohamed Daadaoui, professor of political science at the University of Oklahoma City.
"The instrument of migratory pressure is always used because it is the most effective way to gain more funds and press hard enough to achieve political objectives," agrees Ruth Ferrero Turrión, professor of Political Science at the Complutense University of Madrid.
Ferrero says Morocco's objective could be for the European Union to recognise its sovereignty in Western Sahara.
"Morocco has been lobbying the EU ever since (former US president) Trump recognised Moroccan sovereignty over the territory of Western Sahara. When Trump made this announcement, it meant a kind of protection for Morocco to initiate a diplomatic and political move," Ferrero said.
"Morocco knows that France will support its claims to Western Sahara, but Spain's support is the crucial one, as Spain was historically in charge of the decolonisation process in Western Sahara," she added.
"But Spain has never taken a decisive position on the issue because it fears spoiling its relations with Morocco."
Daadaoui agrees: "It is a leverage on the EU as a whole to push it to take a clearer stance supportive of Morocco’s claim in Western Sahara, especially as the US under Trump came out in support of Morocco’s full sovereignty on Western Sahara."
But Ferrero says it was reckless of the Spanish Foreign Ministry to not report the hospital admission of Ghali.
The Sahrawi leader had been suffering from a COVID-19 infection and it was Moroccan print media that discovered his whereabouts and set off diplomatic alarms in Morocco.
Ferrero says that the Moroccan offensive could have been avoided if European policies were different and gave less power to neighbouring countries as border outsourcing and militarisation is being negotiated.
Turkey has also used migration for political purposes, experts say. Last year, the country said they would not stop migrants trying to get to the EU, causing a humanitarian crisis on the Greek border.
Human rights organisations have called on European countries to do more to support migrants.
"When the EU recognises Turkey as a safe haven, the EU becomes an accomplice. The same is true when Spain does not question Morocco's actions against its own population," Ferrero said.
"The fear of Spain will continue to be used at a time of high political polarisation with issues that have to do with border management or sovereignty, even knowing that these issues further fragment public opinion."