The court said the changes must be made, even at the risk of reducing Israeli security. The decision dealt a setback to Israel's defense establishment and worries Israelis who see the fence as an effective answer to Palestinian suicide bombers, reports CBS News Correspondent Robert Berger.
"Preventing suicide bombers from killing Israelis is much important than the quality of life of some of the Palestinian population," said hawkish Cabinet Minister Danny Naveh.
Palestinians have said the complex of fences, trenches and razor wire is a land grab.
The construction dips deep into the West Bank in some areas, and has disrupted the lives of thousands of Palestinians. About a quarter of the 425-mile barrier has been completed.
"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," the ruling said.
"The route ... injures the local inhabitants in a severe and acute way while violating their rights under humanitarian and international law," it said.
The fence faces another potential obstacle: the World Court in The Hague will rule on the legality of the barrier next week.
Wednesday's case focused on a 25-mile stretch of the barrier northwest of Jerusalem. But the case was seen as setting a precedent for other challenges to the barrier.
"To have the chief justice of the Supreme Court say you can't put the Palestinians in prison ... in the name of the security of Israel, that is really important. That is the least I can say," said Mohammed Dahla, a lawyer for the petitioners.
Dahla said the section near Jerusalem would disrupt the lives of 45,000 people living in 10 villages, cutting them off from their farmland, schools and jobs.
He said the court had ordered changes in more than 20 miles of the stretch. Israel Radio said several miles of completed construction would also have to be dismantled.
The ruling said the route had "severely violated" the local population's freedom of movement and "severely impaired" their livelihoods.
Dany Tirza, the army's chief planner of the route of the barrier, said the decision would delay construction "certainly by many months."
He said everything would return to their original conditions and that Palestinians will receive compensation for their losses.
Brig. Gen. Eran Ofir, the head of logistics in the army, hinted that the ruling could affect other areas of construction.
"In regards to other areas, we will have to consider after checking the ruling and then act accordingly," Ofir said.
"The High Court has made a very important decision, putting a stop to the callousness of a blind and obtuse government and military that thinks it can, with complete disregard, send bulldozers to destroy the lives of hundreds of thousands of Palestinians," said Uri Avneri, a leading member of the Gush Shalom peace bloc.
The court froze construction of the section near Jerusalem in late February, shortly after construction began.
In the Gaza Strip, Israeli troops encircled the Palestinian border town Beit Hanoun with tanks and tore up roads in new efforts to stop a recent spate of rocket attacks on Israeli communities.
It was Israel's eighth major military operation in Beit Hanoun, and security officials said they expected it to be more devastating than previous raids that turned large farming areas into moonscapes, with thousands of trees uprooted.
The latest raid came in response to the first-ever deadly rocket attack from Gaza, when an Israeli man and a 3-year-old boy were killed by a rocket in the border town of Sderot on Monday.
Prime Minister Ariel Sharon promised panicked Israelis in the border area that he would stop the barrages with "wide-ranging actions." Despite the pledge, more rockets fell in Sderot on Tuesday, as Sharon visited. He was unhurt.
The barrages underscored the relative helplessness of Israel's military might against the crude projectiles. Experts say primitive rockets are practically impossible to stop, reports Berger, because the militants can fire them and get away before the high-tech Israeli military can respond.
Military officials and experts warned Tuesday that the militant group Hamas, with the help of Lebanese Hezbollah guerrillas, has managed to increase the range and deadliness of the rockets.
A new threat from Gaza could complicate Sharon's plan to withdraw from the coastal strip by September 2005 and undercut what is now considerable popular support for the plan.
On the first day of the Beit Hanoun operation Tuesday, troops advanced about 700 yards into the town of 21,000, meeting sporadic stone-throwing by teenagers, residents said. Seventeen youngsters were wounded by army fire, one critically, hospital officials said.
Army bulldozers threw up earthen ramparts on some roads to prevent militants from bringing in rocket launchers in vehicles and block their getaway routes, military officials said. Tanks encircled the town.
Beit Hanoun resident Ramadan Shabat, 39, said by telephone that he had stocked up on supplies after Monday's deadly attack on Sderot.
As he spoke, machine gun fire could be heard in the background, and he said that at one point bullets hit one of his windows. He said bulldozers were digging up the street outside his home, and that a sewage pipe had been fractured.
"The real war has started against Beit Hanoun people," he said. "There is nothing we can do except pray to God to save our lives and those of our families."