providing the city with a strong foundation which endured the political conflagrations that were to come, down to modern times. Holy Roman Empire, Polish–Lithuanian Commonwealth, the Swedish and Russian Empires As the influence of the Hanseatic League waned, Riga became the object of foreign military, political, religious and economic aspirations. Riga accepted the Reformation in 1522, ending the power of the archbishops. In 1524, iconoclasts targeted a statue of the Virgin Mary in the cathedral to make a statement against religious icons. It was accused of being a witch, and given a trial by water in the Daugava river. The statue floated, so it was denounced as a witch and burnt at Kubsberg. With the demise of the Livonian Order during the Livonian War, Riga for twenty years had the status of a free imperial city of the Holy Roman Empire before it came under the influence of the Polish–Lithuanian Commonwealth by the Treaty of Drohiczyn, which ended the war for Riga in 1581. In 1621, during the Polish–Swedish War (1621–1625), Riga and the outlying fortress of Daugavgrīva came under the rule of Gustavus Adolphus, King of Sweden, who intervened in the Thirty Years' War not only for political and economic gain but also in favour of German Lutheran Protestantism. During the Russo-Swedish War (1656–1658), Riga withstood a siege by Russian forces. Riga remained one of the largest cities under the Swedish crown until 1710, a period during which the city retained a great deal of autonomous self-government. In July 1701, during the opening phase of the Great Northern War, the Crossing of the Düna took place nearby, resulting in a victory for king Charles XII of Sweden. Between November 1709 and June 1710, however, the Russians under Tsar Peter the Great besieged and captured Riga, which was at the time struck by a plague. Along with the other Livonian towns and gentry, Riga capitulated to Russia, but largely retained their privileges. Riga was made the capital of the Governorate of Riga (later, Livonia). Sweden's northern dominance had ended, and Russia's emergence as the strongest Northern power was formalised through the Treaty of Nystad in 1721. At the beginning of the 20th century Riga was the largest timber export port in the Russian Empire and ranked the 3rd according to the external trade volume. During these many centuries of war and changes of power in the Baltic, and despite demographic