When the French claimed Cambodia as a colony, the 1904 treaty with the Kingdom of Siam defined the watershed of the Dângrêk mountains as the border between the two countries. When the work of the border commission was completed, the Kingdom of Siam asked the French colonial authorities to prepare a map of their findings. The resulting map that was duly presented to and accepted by the Siamese government showed the temple to be on the Cambodian side of the border.
Following Cambodia's independence from France in 1954, Thai forces occupied the temple. Cambodia protested and in 1959, the World Court was asked to intervene. In 1962, the World Court decided by a 9 to 3 vote that the temple belonged to Cambodia. There were mass protests in Thailand and Thailand threatened to boycott meetings of the Southeast Asia Treaty Organisation. Thailand eventually backed down and Cambodia formally took possession of the temple in 1962. Prince Sihanouk, in a gesture of conciliation, declared that the Thai would be able to visit the temple without visas and that Thailand could keep any artefacts it had removed from the site.
When civil war broke out in Cambodia in 1970, forces loyal to the King were able to hold out against the communists until 1975. Because of its easily defensible position, Preah Vihear was the last place in Cambodia to fall to the communist forces.
The temple was constructed in the 9th century AD, but the majority of the temple complex now standing were built the Khmer kings Suryavarman I and Suryavarman II. It was dedicated to the god Siva, in his manifestation as the mountain gods, Sikharesvara and Bhadresvara. The temple is now dedicated to Theravada Buddhism. It is most easily approached from the Thai side (Srisaket Province, Northeast Thailand) and visitors pay a 50 baht fee to enter.
The temple sits top a cliff 525 metres (1722 feet) above the Cambodian plain below.
The central sanctuary was heavily shelled during the Cambodian civil war, but large parts of it have survived, although the tiled roof has not. From the Thai said, the temple is approached via five gopuras (ceremonial gateways), each higher than the rest. After passing each gopura, only the next gopura is visible through it, so at no point is the entire temple complex visible to the visitor except from the air.