Europe needs Morocco as a reliable partner to stop illegal migration.

But it also needs Algeria as a reliable energy supplier.

In an ideal world, one would not exclude the other.

However, in addition to a long border, Morocco and Algeria also share a deep-seated mutual dislike.

That makes it harder for Europe to get both cooperation to fight illegal migration and even more Algerian gas to gain independence from Russia.

For the Spanish government, the first goal is a higher priority and so Prime Minister Sánchez has recognized Morocco's sovereignty over Western Sahara.

This is the second time that Morocco has made concessions conditional on other states recognizing its claim to Western Sahara, which is disputed under international law.

At the end of 2020, that was the price then-US President Trump paid for Morocco to normalize its relations with Israel.

And after Morocco has repeatedly failed to prevent illegal migrants from crossing to Spain (and thus flexing its muscles), Spain is also giving in.

This angers Algeria, the protector of Western Sahara's independence movement.

But Algeria also has effective levers.

It provides natural gas and is another important migration route.

That doesn't make European politics easier towards the hostile neighbors.