On two occasions the Israeli Government has been instructed by the Supreme Court of Israel (SCI) to alter the route of the barrier to ensure that negative impacts on Palestinians would be minimized and proportional  .
Israeli Supreme Court decision of 2004
In February 2004, Israel's High Court of Justice began hearing petitions from two Israeli human rights organizations, the Hamoked Centre for the Defense of the Individual and the Association for Civil Rights in Israel, against the building of the barrier, referring to the distress it will cause to Palestinians in the area. The Israeli High Court of Justice has heard several petitions related to the barrier, sometimes issuing temporary injunctions or setting limits on related Israeli activities.
The most important case was a petition brought in February 2004 by Beit Sourik Village Council, and responded to by the Government of Israel and the Commander of the IDF Forces in the West Bank, concerning a 40 km stretch of existing and planned barrier north of Jerusalem. Several other people and organizations also made submissions. After a number of hearings, judgment was made on June 30. The court agreed with both parties that the West Bank was held by Israel in a state of "belligerent occupation" and that "military administration, headed by the military commander, continues to apply" flowing from "the principles of the Israeli administrative law" and "provisions of public international law... established principally in..." the Hague Conventions.  The court did not rule on "[t]he question of the application of the Fourth Geneva Convention" because "[t]he question is not before us now, since the parties agree that the humanitarian rules of the Fourth Geneva Convention apply to the issue under review."
The first claim made by the petitioners was that construction of the barrier was itself illegal. The court ruled that construction of the barrier for security reasons would be legal even though it would be illegal for political, economic, or social purposes. Since the court accepted the respondent's argument that the part of the barrier under discussion was designed for security purposes, this claim of the petitioners was lost.
The petitioners "by pointing to the route of the Fence, attempt to prove that the construction of the Fence is not motivated by security considerations, but by political ones" argued that if the Fence was primarily motivated by security considerations, it would be constructed on the Green Line. The court rejected their claims, stating: "We cannot accept this argument. The opposite is the case: it is the security perspective – and not the political one – which must examine a route based on its security merits alone, without regard for the location of the Green Line" (Article 30) and noted that "The commander of the area detailed his considerations for the choice of the route. He noted the necessity that the Fence pass through territory that topographically controls its surroundings, that, in order to allow surveillance of it, its route be as flat as possible, and that a 'security zone' be established which will delay infiltration into Israel. These are security considerations par excellence. ... We have no reason not to give this testimony less than full weight, and we have no reason not to believe the sincerity of the military commander." (Article 29)
The second claim made by the petitioners was that the route of the barrier in the region covered by the petition "illegally infringed on the rights of the Palestinian inhabitants". In this case the court ruled that the existing and planned route failed the principle of "proportionality" in both Israeli and international law: that harm caused to an "occupied population must be in proportion to the security benefits". On the contrary, the court listed ways in which the barrier route "injures the local inhabitants in a severe and acute way, while violating their rights under humanitarian international law". Accordingly the court ordered that a 30 km portion of the existing and planned barrier must be rerouted.
Although many in the Israeli government and security establishment reacted with anger to the court's ruling, the public reaction of the government was one of satisfaction that the court had considered the barrier legal in principle. Prime Minister Sharon promised that the court's order would be followed.
Israeli Supreme Court decision of 2005
The Israeli Supreme Court (sitting as "High Court of Justice") in the case of Palestinian petitioners against the Government of Israel determined that the government must find an alternative route to lessen the impact on the rights of the resident Palestinian civilians. The petition to the court was submitted on behalf of five villages that are currently trapped in an enclave created by the existing route of the barrier. The court also ruled that the Advisory Opinion issued by the International Court of Justice in The Hague (which relates to the legal status of the barrier) is not legally binding in Israel. The ruling is the second principled ruling regarding the route of the separation barrier (the first was a ruling on the case of Beit Sourik). The petition which was deliberated on by an expanded panel of nine judges, headed by the President of the Supreme Court, Aharon Barak, was directed against the route of the barrier in the area of the Alfei Menashe enclave, to the south and east of Qalqilyah. The court conducted a review of accounts by the IDF, Israelis architects, Palestinian petitioners, military experts and the International Court of Justice, and ruled that the Government of Israel must find an alternative route to lessen the impact on the rights of the resident Palestinian civilians:
Therefore, we turn the order nisi into an order absolute in the following way: (respondents) must, within a reasonable period, reconsider the various alternatives for the separation fence route at Alfei Menashe, while examining security alternatives which injure the fabric of life of the residents of the villages of the enclave to a lesser extent. In this context, the alternative by which the enclave will contain only Alfei Menashe and a connecting road to Israel, while moving the existing road connecting Alfei Menashe to Israel to another location in the south of the enclave, should be examined.
The court took upon itself the job of examining the fence section by section, even in places where it has already been completed. The International Court of Justice in The Hague determined that all parts of the barrier not on the green line violates international law because it has been built in occupied territory, the Supreme Court determined that the state is entitled to defend itself and its citizens, even in territories defined as "under belligerent occupation" according to the 4th Geneva convention - but it cannot build a fence in order to annex land.
The court conclusion is different from that of the International Court of Justice. According to the Supreme Court:
The main difference between the two judgments stems primarily from the difference in the factual basis upon which each court made its decision. Once again, the simple truth is proven: Facts lie at the foundation of the law, and the law arises from the facts (ex facto jus oritur). The ICJ drew the factual basis for its opinion from the Secretary-General's report, his written statement, the Dugard report, and the Zeigler report. The Supreme Court drew the facts from the data brought before it by the Palestinian petitioners on the one hand, and the State on the other.The ruling by the court will have an impact on roughly 40 different petitions which are now pending before the court asking for changes of the barrier route in several additional sections.