King Taksin (reigned 1767–1782) established himself as King of Siam by right of conquest. He, however, alienated the ecclesiastical support to secure the legitimacy of his reign, and was overthrown in a palace coup. His chief military commander, then on an expedition to enforce recognition of his friend and king by the current ruler of Cambodia, hastened to the rescue. When apprised of the full seriousness of situation, however, he concurred in the overthrow and founded the Royal House of Chakri as King Buddha Yodfa Chulaloke (later styled Rama I, reigned 1782–1809.) He next established the office of the Supreme Patriarch of Thailand. Then, following the precedent of the newly crowned King Wareru of the 13th century, the newly crowned king of Siam commissioned scholars to collect and revise laws from the Ayutthaya era. The Code of Wareru is reflected in successive codes, but the Siamese went beyond it to establish a true code of laws. The Palace Law was a constituent part of this new legal compendium called "The Three Seals Code", which was needed, Rama I said, because old laws were often misinterpreted and this led to injustice. Succession under the "Three Seals Code" took into account the potential of the next king to be, as prescribed by ancient Buddhist texts, a "dhammaraja" (righteous king). This was manifested in his upholding of the Ten Virtues of Kingship.