Free city of Riga
In 1282 Riga became a member of the Hanseatic League. The Hansa was instrumental in giving Riga economic and political stability, thus providing the city with a strong foundation which endured the political conflagrations that were to come, down to modern times.
As the influence of the Hansa 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, a venerated statue of the Virgin Mary in the Cathedral was denounced as 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 Teutonic Knights in 1561, Riga for twenty years had the status of a Free Imperial City, then in 1581, Riga came under the influence of the Polish-Lithuanian Commonwealth. In 1621 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 Russians. Riga remained the largest city in Sweden until 1710 during a period in which the city retained a great deal of self-government autonomy. In that year, in the course of Great Northern War, Russia under Tsar Peter the Great invaded Riga. Sweden's northern dominance ended, and Russia's emergence as the strongest Northern power was formalised through the Treaty of Nystad in 1721.
reproduced from Wikipedia