Israel's High Court has ordered that changes be made to the route of its controversial West Bank barrier to minimise hardships to Palestinians living in the area.
The landmark ruling by the three-judge panel came ahead of an expected decision next week by the International Court of Justice, which was asked by the United Nations to examine the legality of the network of fences and walls.
Israeli High Court ruling
"This route has created such hardship for the local population that the state must find an alternative that may give less security but would harm the local population less. These alternative routes do exist," the High Court said.
The ruling could set a precedent for more than 20 other Palestinian petitions against segments of the barrier that runs some 190 km (118 miles) and is to extend for hundreds more.
Israel says the barrier aims to keep out Palestinian suicide bombers who have infiltrated from the West Bank into Israeli cities and killed hundreds of Israelis in a string of attacks.
Palestinians call it a disguised bid to annex occupied territory they want for a future state since it often snakes well inside the West Bank to take in Jewish settlements.
The case addressed by the High Court was filed by a string of Palestinian villages northwest of Jerusalem. In a first for such cases, they were joined by 30 residents of a nearby Israeli boundary town.
They protested at the Israeli Defence Ministry's plan for a looping stretch of barrier that would cut many villagers off from their olive and citrus groves, from neighbouring villages and from larger West Bank towns serving the rural region.
The court said the stretch near Jerusalem would separate thousands of farmers from olive and citrus groves and it cancelled land confiscation orders issued for the region. "The current path would burden the entire way of life in traditional villages," it said.
"The military commander must consider alternatives that do exist ... Even if they result in a lower level of security, they should bring a substantial - even if not complete - reduction in the damage to the lives of the local inhabitants."
"This is a courageous and very important decision. Of course it is precedent-setting," Mr Mohammed Dahleh, the lawyer for the petitioning villages, told reporters at the court.
"This decision is more important than the one at The Hague because this one will be followed. It says what we said from the beginning, that the building of the wall as it is being built is illegal and that there is another way to build it that will give security to Israel but won't violate Palestinian rights."
Israel's government argued that the barrier segment had to be built further into the West Bank rather than along the boundary to provide a security buffer.
Israel's government has argued that the barrier, expected to extend more than 600 km (370 miles), must be erected well into the West Bank in some places rather than along the boundary to provide a security buffer.
"We will read the decision, look into it and learn from it. After we absorb it, we will act according to the orders of the High Court of Israel," Mr Victor Bargil, deputy director of the Defence Ministry, said on Israel's Army Radio.
Palestinian Prime Minister Ahmed Qurie said the barrier should be removed altogether. "This wall is an act of aggression and should be knocked down as other walls in Berlin and elsewhere were knocked down," he said.