The economic crises rocking Spain and Morocco may favour stronger ties between the neighbouring kingdoms ahead of a top-level Spanish delegation's visit to Rabat, despite their historic differences.
Prime ministers Abdelilah Benkirane of Morocco and Spain's Mariano Rajoy are to meet on Wednesday in the Moroccan capital for the first such high-level encounter in four years.
Numerous bilateral accords will be inked during the visit, which also marks two decades since the signing of a friendship treaty.
Given their long history, the two nations already have strong social and commercial links, with Spain hosting the second largest Moroccan expatriate community (around one million) after France, and having become its top economic partner in January.
Around 20,000 small- and medium-sized Spanish businesses export to Morocco.
And aside from the tiny north African enclaves of Ceuta and Melilla, held by Spain for more than 400 years but considered occupied by Rabat, the prospects for closer cooperation are promising.
"It is a good moment for us too. The crisis in Europe has brought opportunities," and the more sensitive issues "make themselves felt less," Spain's ambassador to Morocco, Alberto Navarro, told AFP.
"That prompts our businesses to look outside the European Union, starting in this case with our neighbours," he added.
Another Morocco-based European diplomat agreed.
"Spain, in the current context, needs to develop its external cooperation," he said.
On the other hand, "there is a Moroccan campaign that hopes to push Madrid on Western Saharan," the ex-Spanish colony which Rabat annexed in 1975 in a move never recognised by the international community.
In addition, while not as badly affected by the European debt crisis as its northern neighbour, Morocco has suffered the knock-on effects, as economic growth dropped from 4.5 percent in 2011 to less than 3.0 percent this year.
But Spanish exports to Morocco saw a rise of more than 20 percent in the first half of 2012, compared with the previous year.
"There is a warming-up in relations, which derives from the mutual desire to guard against future crises, economic for sure, but also migratory," the European diplomat said.
He noted that Spain was the only country mentioned by King Mohammed VI in his last public speech in early August.
Stemming the flow of illegal sub-Saharan immigrants, a top political priority for Spain in its dealings with Morocco, remains a potentially divisive issue that has also led to surprisingly close cooperation.
Last month, as well as cooperating to evict scores of African migrants who had swum to a tiny Spanish islet off the Moroccan coast, a joint border project was set up with European funds.
"Several indicators have revealed a real change in Rabat-Madrid relations," Al-Tajdid, the newspaper of Morocco's ruling Islamist party the PJD, commented last week.
At the diplomatic level, Rajoy already visited Rabat in January, his first trip abroad since taking office, while Benkirane travelled to Madrid in May, and in September an inter-parliamentary forum was held in the Moroccan capital.
To boost trade during the upcoming visit, Spain will be eyeing the chance to further participate in Morocco's ambitious renewable energy plans, which include the construction of five major solar power plants by 2020.
Two Spanish firms were named last week as minority partners in the first such project, near the desert frontier town of Ouarzazate.
An easing of visa restrictions, meanwhile, is likely to be one of the accords that some Moroccans are hoping will be announced on Wednesday.