JERUSALEM — The European Union recently affirmed that there is no international legal problem in signing a deal with an occupying power that extends to the territory it occupies, or from foreign companies doing business in occupied territory.

It did so when it provisionally approved a fisheries agreement earlier this month with Morocco that extends into the territory of occupied Western Sahara, which is beyond Morocco’s recognized sovereign territory.

Moreover, the EU actually pays Morocco for European access to Western Saharan resources. On all these points, the agreement directly contradicts what the EU, in negotiations with Israel, calls fundamental principles of international law.

In recent years, Europe has contested Israel’s insistence that its EU agreements do not apply to Israel’s activities in the West Bank. The EU stance has been celebrated by some as an example of European commitment to international law. The EU’s new deal with Morocco appears to be contradicting those principles.

Moreover, the European Parliament’s legal advisor issued a formal opinion earlier this month making it clear that it is the EU’s treatment of Morocco, not Israel, that accords with international law.

By inventing rules of international law, the EU actually sends the message that Israel might never “comply” with international law, because where Israel is concerned, this “law” is a moving target, that can be concocted from thin air.

Morocco invaded Western Sahara in 1975 and has occupied it since, claiming it as its own territory. The Security Council has condemned Morocco’s presence and demanded a complete withdrawal.

More from GlobalPost: The world's food supply depends on Morocco. Here's why

In the face of this demand, Morocco has initiated an aggressive settlement policy. As a result, Moroccan settlers may now be the majority in the territory.

The EU, like the rest of the world, does not recognize Western Sahara as part of Morocco, but this has not stopped EU from extending its agreements with Morocco to cover Western Sahara. The Polisario Front is the generally recognized representative of the indigenous people of Western Sahara, and it vigorously opposes the EU deal.

The Moroccan agreement contradicts two central elements of the EU’s legal approach to Israel. The EU says that any application of agreements to the occupied territories would violate international law by “recognizing” Israel’s control. Yet while the EU also refuses to recognize Moroccan claims to Western Sahara, it sees no tension between this and extending its agreements with Morocco to that territory.

The EU says it cannot spend a cent on Israeli-sponsored activities in the occupied territories, while in Western Sahara, Europe will actually pay Morocco for its exploitation of natural resources there.

The controversy over EU deals with Morocco led to a ruling from the European Parliament’s legal advisor. In brief, the official opinion says international law does not prevent Morocco from exploiting the natural resources of the occupied territory, or for the EU to pay Morocco to exploit the resources of occupied territory.

The EU position regarding Western Sahara is consistent with prior international law, including a 2002 opinion by the Security Council’s legal advisor, and a ruling of the French Court of Appeals this summer, as well as the general practice of nations.

The EU is right about Western Sahara — which means it is wrong about Israel.

To be sure, there are differences between the EU’s policies toward Western Sahara and the West Bank; the former is much worse.

In Western Sahara, the EU has licensed the exploitation of scarce natural resources. In the West Bank, the EU seeks to punish pure academic and business activity that do not exhaust resources but only create jobs and opportunities for Arabs and Jews.

Moreover, Israel’s economic activity in the West Bank is confined to areas under Israeli jurisdiction by agreement with Palestinian authorities under the Oslo Accords. Morocco’s activities have no limitations, because unlike Israel, it has not turned over most of the territory to Polisario rule.

Ironically, the inconsistency in European policies sends exactly the opposite message from that intended by Europe. In its dealings with Israel, the EU wants to make clear that it opposes settlements.

Fair enough. But implicitly, Europe is telling Israel that the problem is not its presence in the disputed territories, but rather that it does not have enough presence; in particular, not enough economic enterprises.

Spanish and French businesses, interested in opportunities in the Western Sahara, are pressing the EU to sign the deal with Morocco.

The Moroccan precedent suggests that if significant Israeli defense, high-tech or biotech enterprises were located in the West Bank, the EU would reduce diplomatic pressures on Israel.

The message Europe wants to send Israel through its tough diplomatic line is that the occupation of the West Bank and settlements are the source of its diplomatic problems. But by not holding any other occupation to the same standard, Europe sends another message: it is not the settlements that bother Brussels — rather, it is Israel itself.

Eugene Kontorovich is a professor of international law at Northwestern University School of Law in Chicago and a senior fellow at the Kohelet Policy Forum in Jerusalem.