Emperor Tenji was the 38th emperor of Japan according to the traditional order of succession. Initially known as Prince Kazuraki, and later Prince Naka no Ōe, he was the son of two future sovereigns: Emperor Jomei and Empress Kōgyoku. His father ascended to the throne in 629; after his death in 641, a succession dispute emerged between the young Prince Naka and another royal prince, Prince Yamashiro. This was mediated by the ascension of his mother as empress. Naka conspired with a group of aristocrats to assassinate the despotic minister Soga no Iruka in 645. After the assassination, his mother resigned as ruler and Naka served as the crown prince for his uncle, Emperor Kōtoku. However, after Kōtoku's death in 654, the throne instead returned to Naka's mother. During the early 660s, Saimei died and the Japanese military suffered a defeat against the forces of Tang China and Silla during an expedition to Korea. Prince Naka did not immediately ascend to the throne, instead serving as regent for the following seven years.