turned out, these scholar-officials acquired status in their local communities, family ties, and shared values that connected them to the imperial court. From Tang times until the closing days of the Qing dynasty in 1911–1912, scholar officials often functioned often as between the grassroots level and the government. This model of government had an influence on Japan and Korea. Medieval History Goryeo Silla slowly began to decline and the power vacuum this created led to several rebellious states rising up and taking on the old historical names of Korea's ancient kingdoms. Gyeon Hwon, a peasant leader and Silla army officer, taking over the old territory of Baekje and declared himself the king of Hubaekje ("later Baekje"). Meanwhile, an aristocratic Buddhist monk leader, Gung Ye, declared a new Goguryeo state in the north, known as Later Goguryeo (Hugoguryo). There then followed a protracted power struggle for control of the peninsula. Gung Ye began to refer to himself as the Buddha, began to persecute people who expressed their opposition against his religious arguments. He executed many monks, then later even his own wife and two sons, and the public began to turn away from him. His costly rituals and harsh rule caused even more opposition. He also moved the capital in 905, changed the name of his kingdom to Majin in 904 then Taebong in 911. In 918, Gung Ye was deposed by his own generals, and Wang Geon, the previous chief minister was raised to the throne. Gung Ye is said to have escaped the palace, but was killed shortly thereafter either by a soldier or by peasants who mistook him for a thief. Wang Geon, who would posthumously be known by his temple name of Taejo of Goryeo. Soon thereafter, the Goryeo dynasty was proclaimed, and Taejo went on to defeat the rivaling Silla and Hubaekje to reunite the three kingdoms in 936. Following the destruction of Balhae by the Khitan Liao dynasty in 927, the last crown prince of Balhae and much of the ruling class sought refuge in Goryeo, where they were warmly welcomed and given land by Taejo. In addition, Taejo included the Balhae crown prince in the Goryeo royal family, unifying the two successor states of Goguryeo and, according to Korean historians, achieving a "true national unification" of Korea. Mongol Empire and Yuan dynasty In the early 13th century Genghis Khan united warring Mongol tribes into