The EU's top court on Wednesday cancelled two trade deals that had allowed Morocco to export farm products and fish to the bloc from the disputed Western Sahara, a ruling hailed by the Polisario independence movement.
Morocco, a key trading partner with the 27-member European Union, views the Western Sahara as an integral part of its territory, but the Polisario, recognised internationally as the representative of the Sahrawi people, has long sought independence there.
The EU's Court of Justice ruled that the deals, allowing exports from the former Spanish colony as well as the rest of Morocco, had been signed "without the consent of the people of Western Sahara", adding that the Polisario's status allowed it to bring complaints against the bloc.
Therefore they had "infringed the European Union's obligations in the context of its relations with Morocco under EU and international law," it said.
In conclusion, the ruling annulled EU-Moroccan agreements "amending the tariff preferences granted by the European Union to products of Moroccan origin and, second, the Sustainable Fisheries Partnership Agreement", it said.
The accords will however remain in place for two months in order to "preserve the European Union's external action and legal certainty over its international commitments", it ruled.
Morocco controls around 80 percent of the territory and has offered autonomy, while insisting it must retain sovereignty.
At stake are an overland route to West African markets, plentiful phosphate resources and rich Atlantic fisheries along the territory's 1,100-kilometre (680-mile) coastline.
The Polisario's EU envoy Oubi Bachir welcomed the ruling, tweeting that it was "A great victory for the Sahrawi people!"
After the court ruling, Morocco and the European Union issued a joint statement underlining that their trade partnership would continue.
"We remain fully mobilised to continue the cooperation between the European Union and the Kingdom of Morocco, in a climate of serenity and commitment," the bloc's top diplomat, Josep Borrell, and Moroccan Foreign Minister Nasser Bourita said.
The two sides signed an association deal in 1996, giving Morocco preferential tariffs including on products from the Western Sahara.
The farm products protocol was renewed in 2012, and the fishing one in 2019.
Rabat's main benefit is lower costs of exporting its agricultural goods to the bloc, while the EU benefits from access to Atlantic fishing waters.
The fishing protocol, cancelled by Wednesday's ruling, had allowed up to 128 European ships to access Moroccan and Western Sahara fishing waters for four years.