In the 11th century, the Khmer empire, which was based in modern day Cambodia, was expanding across Southeast Asia. They eventually took over almost all of the Dvaravati kingdom, except for Haripunchai in the north. Haripunchai fought two wars with Lopburi, but they were able to keep their independence. After their wars with Lopburi, Haripunchai enjoyed a brief “Golden Age” before eventually being taken over by the Thai kingdom of Lanna in 1281.