The Hague-based court ruled on Friday that parts encroaching on Palestinian territory should be dismantled and Israel had to pay compensation for damage caused by the West Bank wall.
"The wall … cannot be justified by military exigencies or by the requirements of national security or public order," said Judge Shi Jiuyong of China
"The construction of such a wall accordingly constitutes breaches by Israel of its obligations under the applicable international humanitarian law."
The International Court of Justice (ICJ) also rejected Israel's contention it did not have jurisdiction to rule on the legality of the barrier Israel is building in the West Bank.
Court ruled Israel should
act within international law
Judge Shi said: "The Court cannot accept the view ... that it has no jurisdiction because of the 'political' character of the question posed ...".
Israel has said it will not accept a ruling from the ICJ on the network of fences, ditches and concrete wall it says it is building to keep out bombers. Palestinians call it a land grab that destroys their hopes of a viable state.
"The court accordingly has jurisdiction to give the advisory opinion," he said.
The Palestinians hailed the ruling of the UN's top court, saying it should be followed by the imposition of international sanctions.
"This is a historic day and a historic decision that has been delivered by the world's highest legal authority," prime minister Ahmad Quraya said from his West Bank offices, as the judges in the Hague read their non-binding judgement.
Earlier, with media reports predicting a ruling unfavourable to Israel, a top adviser to Yasir Arafat said Palestinians would seek UN sanctions against the Israel. "As of today, Israel should be viewed as an outlaw state," Nabil Abu Rdainah said.
PLO legal adviser Anwar Darkazally said the ruling was significant, considering it was the UN General Assembly that took the case to the World Court.
"Its not Palestine against Israel, but its the world against Israel," he said.
Citing the 1971 verdict against South Africa which eventually led to sanctions against the country and the ultimate fall of the apartheid regime, Darkazally said the latest ruling could also have far reaching impact.
"It's very like that the Palestinian Authority will take the ruling to the General Assembly, and try to get them to issue a resolution condemning Israel and calling for dismantling of the wall," he said.
Palestinians brand the barrier a precursor to annexation of land Israel captured in the 1967 Middle East war and where they seek a viable state under a US-backed "road map" peace plan.
ICJ: Palestinians are 'trapped by
twists and turns in the barrier'
While the World Court acknowledged Israel's duty to protect its citizens, it said Israel had to do so within the law and should compensate Palestinians for homes and land lost or damaged by the building of the 100-metre wide strip of walls, ditches and fences.
Only American judge Thomas Buergenthal dissented from his 14 international colleagues' opinion, a leaked document of the ruling showed.
An Aljazeera correspondent in the Hague reported that Buergenthal surprised the others with his dissenting comments. He differed on all the points raised by the majority except the authority of the court to try the case.
In a three-page statement judge Buergenthal echoed and adopted the Israeli position that the Arab judge in the panel Nabil Arabi, was biased against Israel, reported the correspondent.
Egyptian international law specialist Abd Allah Ashal told Aljazeera the ruling was the biggest defeat for Israel internationally.
The ruling was a great victory for the Palestinians, Ashal said.
Ashal denied that the court ruling was non-binding. He cited the case of Namibia where the court's opinion had an impact on its eventual independence from South Africa.
"The international community should consider how to get Israel to abide by international law."
Arab League spokesman
Ashal said the UN was committed to the court's ruling.
For its part, the Arab League said the ruling represents a "victory for international law".
"After the legal picture has become clear, the international community should consider how to get Israel to abide by international law," Husam Zaki, a spokesman for Arab League Secretary General Amr Musa, said.
Strong support for the court's ruling has also come from Palestinian sources, our correspondent reported.
"There were some clauses in the ruling that went beyond Palestinian expectations," Kamil said.
The White House, however, brushed aside the ICJ ruling, saying it did not think it was the right forum for addressing the issue.
"We do not believe that that's the appropriate forum to resolve what is a political issue. This is an issue that should be resolved through the process that has been put in place, specifically the road map," White House spokesman Scott McClellan said.