In 1558, Tsar Ivan the Terrible of Russia invaded Livonia, starting the Livonian War. The Livonian Order was decisively defeated in 1560, prompting Livonian factions to seek foreign protection. The majority of Livonia accepted Polish rule, while Reval and the nobles of Northern Estonia swore loyalty to the Swedish king, and the Bishop of Ösel-Wiek sold his lands to the Danish king. Russian forces gradually conquered the majority of Livonia, but in the late 1570s the Polish-Lithuanian and Swedish armies started their own offensives and the bloody war finally ended in 1583 with Russian defeat. As result of the war, Northern Estonia became Swedish Duchy of Estonia, Southern Estonia became Polish Duchy of Livonia, and Saaremaa remained under Danish control.