The UN's top court has ruled that most of the disputed land around a flashpoint ancient temple on the Thai border belongs to Cambodia and that Thai security forces should leave.

The International Court of Justice (ICJ) interpreted a 1962 ruling saying that "Cambodia had sovereignty over the whole territory of the promontory of Preah Vihear".

"In consequence, Thailand was under an obligation to withdraw from that territory Thai military or police forces or other guards or keepers who were stationed there," said judge Peter Tomka.

Cambodia has welcomed the ruling, which appears to have reached a compromise on the amount of land to be ceded by Thailand.

Prime minister Hun Sen addressed his nation on television, reiterating a pledge to work with Thailand to keep the border peace and "not do anything that will lead to tension".

But he added: "This is a significant step forward... towards a peaceful resolution."

At The Hague, Cambodia's foreign minister, Hor Namhong, said: "We cannot say the verdict from the court today satisfies our goal 100 per cent, but we are happy ... the verdict has rendered most of what we want."

Thai PM agrees to talks

Thailand's prime minister Yingluck Shinawatra has agreed to hold talks with Cambodia over the issue, adding she would protect her country's interests.

"The government has asked the military ... to take care of peace along the border," she said in a television address.

The ruling has added further pressure on the prime minister's government, which is already grappling with mass street demonstrations against a controversial political amnesty bill.

At least 28 people have been killed in outbreaks of violence since 2011 over the ownership of the patch of border land next to the 900-year-old Preah Vihear temple.

Ahead of the ruling by the ICJ, there were fears the decision would revive nationalist tensions and spark renewed clashes.

Tens of thousands of people were displaced in the 2011 fighting, leading Cambodia to ask the ICJ for an interpretation of an original 1962 ruling.

Thailand does not dispute Cambodia's ownership of the temple, a UNESCO World Heritage site, but both sides laid claim to the adjacent 4.6-square-kilometre piece of land.

Leaders of the two countries called for calm ahead the ruling by 17 international judges, whose decision is binding and cannot be appealed.

The roots of the dispute lie in maps drawn up in 1907 during French colonial rule.

Cambodians evacuate ahead disputed hotspot

The mood on both sides of Preah Vihear temple was tense ahead of the ruling, with tourists still allowed to visit the ancient structure via Cambodian territory, but journalists were denied access.

Cambodian villagers said they were taking no chances and had prepared bunkers or evacuated their homes.