The Joseon dynasty endured two major invasions prior to its progressive loss of sovereignty in the late 19th century. These were the Seven-Year War, a two-stage Japanese invasion led by Toyotomi Hideyoshi in the 1590s, and the First and Second Manchu invasions in the early 17th century. Although the Japanese were ultimately repelled, Joseon was compelled to surrender to the Manchus, who later became the Qing dynasty.