Today's case specifically involves a 40-kilometer stretch of the barrier northwest of Jerusalem. The court had frozen construction of this section last February, shortly after construction began.
The court today ordered that section of the wall rerouted, even if it provides less security.
The court said the wall's planned route injures some 35,000 local inhabitants "in a severe and acute way while violating their rights under humanitarian and international law." It also said: "The route disrupts the delicate balance between the obligation of the military commander to preserve security and his obligation to provide for the needs of the local inhabitants."
Mohammed Dahla, a lawyer for the petitioners against the barrier, spoke at the court after the ruling.
"The court's decision was that the main part of the wall is illegal," Dahla said. "More than 80 or 90 percent of the wall that was supposed to be built in an area of more than 40 kilometers is basically illegal because it's not proportionate. It violates the human rights of the Palestinians. It puts Palestinians in prisons. These are the words that the Chief Justice Arun Barak used."
Dahla said the ruling establishes a principle that there are limits as to how far the military can go in seeking to provide security for the residents of Israel. Dahla said the judgment cuts more deeply into the legality of the construction than the issue of the route alone.
"[Barak] said, basically, most of the military orders, the confiscation orders, are nullified now, and the military commander should now go back and do some homework before he starts building or planning a wall in that area," Dahla said.
In Jerusalem, Israeli Foreign Ministry spokesman Jonathan Peled said the government will honor the ruling.
"The government of Israel will, of course, respect all decisions of the Supreme Court as Israel is a democratic country, with a separation of powers and an independent judiciary," Peled said.
Palestinian Prime Minister Ahmed Qureia dismissed the court's decision as irrelevant.
"I don't think it is a matter of changing the route or not. It is being built. It is a wall -- a separation wall -- which is being built on the Palestinian territories," Qureia said.
The Israeli military said the ruling will delay construction on the barrier and that Palestinians affected by the section in question will be compensated for losses.
Today's ruling by a three-judge panel precedes an action by the UN's International Court of Justice (ICJ). The ICJ announced last week that on 9 July it will issue an advisory opinion on the legal consequences of the construction of the wall.
The UN itself asked for the ruling, and the ICJ held hearings on the question in February.
Opponents of the wall conceded that, under international law, "military necessity" might justify such an undertaking. However, they said, the principle of "military necessity" could not extend to protecting foreign settlers in an occupied territory.
Israel declined to participate in the February hearings. It challenged the legal competence of the ICJ to issue a ruling.
Dahla, the lawyer for the Palestinian petitioners, said today that the Israeli court's ruling is more important than that pending at the ICJ. As he put it, "This one will be followed."