Bilateral relations between Cambodia and Thailand date to the 13th century during the Angkor Era. The Thai Ayutthaya Kingdom gradually displaced the declining Khmer Empire from the 14th century, importing much of its customs and culture. French protectorateship separated Cambodia from modern Thailand at the turn of the 19th–20th centuries, and diplomatic relations between the modern states were established on 19 December 1950. Relations between the two countries remain complicated. Incomplete demarcation of their boundaries has led to a protracted border conflict, most notably over the temple of Preah Vihear, which was brought to the International Court of Justice in 1962 but still saw military clashes emerge in 2008 and 2011. Cambodia's internal conflicts throughout the 1970s to 1980s often spilled over into Thailand, which received refugees but also gave indirect support to the Khmer Rouge. Thailand now dominates over its poorer neighbour economically, and is the sixth largest investor in Cambodia. Though relations are largely peaceful, the countries' peoples still bear a degree of enmity, which has erupted into violence when stoked by nationalist sentiments. Such episodes include a mob attack on the Thai Embassy in Phnom Penh in 2003, which prompted a downgrading of relations by Thailand. Thailand also downgraded relations in 2009 in response to the Cambodian government's support of former Thai Prime Minister Thaksin Shinawatra, while Cambodia terminated relations (represented by its embassy in Bangkok) twice in 1958 and 1961, during the Preah Vihear conflict. History Angkorian Era Following Jayavarman VII's death, the Khmer Empire experienced a gradual decline. Important factors were the neighboring peoples (Thai and Cham), chronic interdynastic strife, and the gradual deterioration of the complex irrigation system that had ensured rice surpluses. During the 13th century, Thai people began to rise up, Jayavarman VIII suffered a devastating war against the Sukhothai Kingdom led by Si Inthrathit. The Angkorian monarchy survived until 1431, when the Thai under Borommarachathirat II, captured Angkor Thom and the Cambodian king fled to the southern part of the country. Longvek Era The Thai conquest of the new capital at Lovek in 1594 marked a downturn in the country's fortunes and Cambodia. Becoming a pawn in power struggles between its two increasingly powerful neighbors, Siam and Vietnam. Vietnam's settlement of the Mekong Delta led to its annexation of that area at the end of the 17th century. Vietnamese pioneers employed a strategy of settle and claim. Such foreign encroachments continued