The land was owned by Modderklip Boerdery at Benoni in Gauteng. Five years ago about 50 hectares was invaded by black squatters.
Delivering judgment on Friday the deputy chief justice Pius Langa noted that failure by the State to protect farmers from land invasions would be "a recipe for anarchy" - in a judgment upholding the constitutional right to property.
Democratic Alliance agriculture and land affairs spokesperson Kraai van Niekerk - South Africa's first post-apartheid Agriculture Minister when he was still in the National Party - said, however, it was "shameful that it has taken five years of legal action by Modderklip to get government to recognise its democratic rights.
"It is also outrageous that the chief justice, and not the Minister of Agriculture and Land Affairs (Thoko Didiza) had to be the one to point out that allowing an invasion of this nature to occur unchecked would be 'a recipe for anarchy'.
"The case also sets an important legal benchmark by showing that government will find itself on the wrong side of the law whenever it neglects private property rights in any way during the course of the land reform process."
Van Niekerk said: "Only by maintaining the rule of law and upholding the principle of willing buyer-willing seller will the government be able to secure political and economic stability in our country, and retain the confidence of the international community."
He said invasions of this nature occurred "because of a lack of available houses or even open land for homeless South Africans.
"An event of this magnitude should make government aware that its delivery in these areas has been seriously inadequate, and that it must urgently accelerate its construction of low cost housing and its purchase and redistribution of land.
Meanwhile AgriSA's president Lourie Bosman said it was "delighted" by the court's decision. "This judgment brings renewed confidence in the legal process as well as the way in which our courts interpret the Bill of Rights in particular.
"The balanced approach in this matter is evidence of a well thought through reasoning by the court," said Busman.
He said the court had significantly declared that the landowner was entitled to compensation "in respect of the land which has been illegally occupied as from May 31 2000" - the date of the illegal occupation.
"This judgment has also brought certainty regarding a very sensitive issue, being illegal land invasion. It is now clear that our courts will not tolerate land invasion."