The International Court of Justice has ruled that ancient temple land near the Cambodia-Thai border belongs to Cambodia. It's been the site of repeated clashes between the two countries' armies in recent years.
The UN's highest court, the ICJ, said on Monday "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," Judge Peter Tomka said.
The dispute centered around a 4.6-square-kilometer (1.8 square mile) piece of land adjacent to the 900-year-old Preah Vihear temple, perched on a rocky plateau overlooking both countries.
Cambodia asked the court for an interpretation of an original 1962 ruling, after an outbreak of violence in 2011 killed at least 28 people and displaced thousands, but there are fears Monday's decision could spark renewed clashes and revive nationalist tensions.
Thailand did not dispute Cambodia's ownership of the temple, a UNESCO World Heritage Site, but says the ICJ did not draw definitive boundaries around the site.
It was UNESCO's listing of the site in 2008 that reignited the debate. Following the deadly fighting three years later, the ICJ created a demilitarized zone around the temple.
Monday's ruling unnerved communities on both sides of the border. Dozens of Thai schools closed and some Cambodian residents resorted to digging bunkers or left their villages altogether.
Thai prime minister Yingluck Shinawatra used social media to stress her government would "consult" with Cambodia after the decision, to avoid any conflict.
"On Monday evening after the verdict is delivered the government will announce its position," she said on Facebook.
The verdict comes at a vulnerable time for Thailand. An amnesty bill that could pave the way for Yingluck Shinawatra's divisive brother Thaksin to return to the country has prompted mass protests in Bangkok since the beginning of the month.
Thaksin Shinawatra is also close to Hun Sen, the Cambodian prime minister. There is speculation that if the ICJ rules against Thailand, its opposition will direct public anger against Yingluck Shinawatra's government.