The European Commission backed Spain's new position on the fate of Western Sahara as an autonomous region of Morocco, supporting a surprise change of tack by the government of Pedro Sanchez that has met with much domestic opposition.
"The European Union welcomes any positive development...between its member states and Morocco in their bilateral relations, which can only be beneficial for the implementation of the Euro-Moroccan partnership," said Nabila Massrali, a spokeswoman for EU foreign policy chief Josep Borrell.
Morocco considers Western Sahara its own but an Algeria-backed independence movement demands a sovereign state. For years most countries, including Spain, had advocated for an independence referendum to determine its fate.
Madrid told Rabat on Friday that it regarded its autonomy proposal for Western Sahara as "serious, credible and realistic," in a move expected to help patch up sour relations between the two countries.
The change of position - led by Sanchez's Socialist Party - came as a surprise to the coalition government's junior partner, the far left Podemos party, which criticised the move. They were joined by dissenting voices from experts, media and non-governmental organisations.
In recent years the prospect of an independence referendum has waned and even the United Nations has ceased referring to a vote, speaking instead of seeking a realistic, mutually acceptable solution based on compromise.
The EU reaffirmed its support for the efforts of the U.N. secretary-general for a "just, realistic, pragmatic, lasting and mutually acceptable political solution to the Western Sahara issue," the spokesperson told reporters on Monday.
Relations cooled between Spain and Morocco last year after Madrid admitted a Western Sahara independence leader for medical treatment using Algerian documents.
In an apparent retaliation, Rabat then appeared to relax border controls with Ceuta, a Spanish enclave in northern Morocco, leading to an influx of at least 8,000 migrants, most of whom were later returned.
As a result of Spain's change of position, Morocco will return its ambassador to Madrid and Algeria, a strategic partner of Spain as the main gas supplier, recalled its representative for consultations.
(Reporting by Belén Carreño; editing by Nathan Allen and Jonathan Oatis)