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 Daugavgriva 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.