The history of Riga, the capital of Latvia, begins as early as the 2nd century with a settlement, the Duna urbs, at a natural harbor not far upriver from the mouth of the Daugava River. Later settled by Livs and Kurs, it was already an established trade center in the early Middle Ages along the Dvina-Dnieper trade route to Byzantium. Christianity had come to Latvia as early as the 9th century, but it was the arrival of the Crusades at the end of the 12th century which brought the Germans and forcible conversion to Christianity; the German influence instituted over the city lasted until independenceand is still preserved today in Riga's Jugendstil architecture.

From the 13th century to the birth of nationalism in the 19th and independence in the 20th, Latvia's and Riga's history are intertwined, a chronicle of the rise and fall of surrounding foreign powers over the Latvians and their territory. As a member of the Hanseatic League, Riga's prosperity grew throughout the 13th–15th centurieswith Riga to become a major center of commerce and later, industry, of whatever empire it found itself subject of.

Today, Riga and its environs are home to close to half of Latvia's inhabitants.

Founding of Riga

The Daugava River (Western Dvina, Dúna in Old NorseRune Edberg: Vägen till Palteskiuborg, English Summary, retrieved 24 July 2009) has been a trade route since antiquity, part of the Viking's Dvina-Dnieper navigation route via portage to Byzantium.Bilmanis, A. Latvia as an Independent State. Latvian Legation. 1947. A sheltered natural harbor 15 km upriver from the mouth of the Daugavathe site of today's Rigahas been recorded as an area of settlement, the Duna Urbs, as early as the 2nd century, when ancient sources already refer to Courland as a kingdom. It was subsequently settled by the Livs, an ancient Finnic tribe who had arrived during the 5th and 6th centuries, about the same time that Riga began to develop as a center of Viking trade during the early Middle Ages.

Archeological digs at the sites of Riga Town Hall (Albert) Square () and at the corner of Peldu and Ūdensvada streetsBerga Tatjana, Celmiņš Andris. Rīgā Peldu ielā atrastais 13. gadsimta monētu depozīts, LATVIJAS VĒSTURES INSTITŪTA ŽURNĀLS (Journal of the Latvian Historical Institute), 2005, No. 3 offer glimpses into Riga's residents of the 12th century. These show that Riga was inhabited mainly by the Kurs, Kursified Livs, and Livs of the Daugava river basin. They occupied themselves mainly with crafts in bone, wood, amber, and iron; fishing, animal husbandry, and trading.

The Chronicle of Henry of Livonia (Chronicle) mentions Riga's earliest recorded fortifications upon a promontory, Senais kalns ("ancient hill"), later razed in the 18th century, becoming the site of Riga's Esplanade.Esplanāde, entry in the Latvian Encyclopedia dictionary, retrieved 7 July 2008 It also testifies to Riga having long been a trading center by the 12th century, referring to it as portus antiquus (ancient port), and describes dwellings and warehouses used to store mostly corn, flax, and hides.

The origin of the name of Riga has been speculated to be related to ancient Celts—based on root similarity to words such as Rigomagos and Rigodunon, or that it is a corrupted borrowing from the Liv ringa meaning loop, referring to the ancient natural harbor formed by the tributary loop of the Daugava and being and earlier and common Liv place name for such formations.Endzelīns, Did Celts Inhabit the Baltics (1911 Dzimtene's Vēstnesis (Homeland Messenger) No. 227) , retrieved 24 July 2009 The evidence is conclusive, however, that Riga owes its name to its already-established role in commerce between East and West, as a borrowing of the Latvian rija, for warehouse, the "y" sound of the "j" later transcribed and hardened in German to a "g"most notably, Riga is named Rie (no "g") in English geographer Richard Hakluyt's 1589 The Principal Navigations,Pronouncing the "i" and "e" separately, REE-eh, is the best approximation to the Latvian rija, as "Ria" would result in an "i" not "ee" sound. and the origin of Riga from rija is confirmed by the German historian Dionysius Fabricius (1610):Fabrius, D. Livonicae Historiae Compendiosa Series, 1610

German traders began visiting Riga and its environs with increasing frequency toward the second half of the 12th century, via Gotland. Bremen merchants shipwrecked at the mouth of the DaugavaLansdell, H. "Baltic Russia", Harper's New Monthly Magazine, July 1890. established a trading outpost near Riga in 1158. The monk Meinhard of Segeberg, a missionary, arrived from Gotland in 1184.Vauchez et al. Encyclopedia of the Middle Ages. Routledge, 2001Dollinger, P. The Emergence of International Business 1200–1800, 1964; translated Macmillan and Co edition, 1970 Christianity had established itself in Latvia more than a century earlier: Catholicism in western Latvia, with a church built in 1045 by Danish merchants, but arriving as early as 870 with the Swedes;Wright, C.T.H. The Edinburgh Review, THE LETTS, 1917 Orthodox Christianity being brought to central and eastern Latvia by missionaries. Many Latvians had been already baptised prior to Meinhard's arrival. Meinhard's mission, nevertheless, was no less than mass conversion of the pagans to Catholicism. He settled among the Livs of the Daugava valley at Ikšķile (), about 20 km upstream from Riga. With their assistance and promise to convert,Laffort, R. (censor), Catholic Encyclopedia, Robert Appleton Co., 1907 he built a castle and church of stonea method heretofore unknown by the Livs and of great value to them in building stronger fortifications against their own enemies. Hartwig II, Prince-Archbishop of Bremen, was eager to expand Bremen's power and properties northward and consecrated Meinhard as Bishop of Livonia (from the ) in 1186, with Ikšķile as bishopric. When the Livs failed to renounce their pagan ways, Meinhard grew impatient and plotted to convert them forcibly. The Livs, however, thwarted his attempt to leave for Gotland to gather forces, and Meinhard died in Ikšķile in 1196, having failed his mission.Germanis, U. The Latvian Saga. 10th ed. 1998. Memento, Stockholm.

Hartwig appointed abbot Berthold of Hanoverwho may have already traveled to Livoniaas Meinhard's replacement. In 1198 Berthold arrived with a large contingent of crusaders and commenced a campaign of forced Christianization. Latvian legend tells that Berthold galloped ahead of his forces in battle, was surrounded and drew back in fright as someone realizing they have stepped on an asp, at which point the Liv warrior Imants (or, Imauts) struck and speared him to death. Ecclesiastical history faults Berthold's unruly horse for his untimely demise.

The Church mobilized to avenge Berthold's death and defeat of his forces. Pope Innocent III issued a bull declaring a crusade against the Livonians, promising forgiveness of sins to all participants. Hartwig consecrated his nephew, Albert, as Bishop of Livonia in 1199. A year later, Albert landed in Riga with 23 ships and 500 Westphalian crusaders.Tolstoy-Miloslavsky, D. The Tolstoys: Genealogy and Origin. A2Z, 1991 In 1201 he transferred the seat of the Livonian bishopric from Ikšķile to Riga, extorting by force agreement to do so from the elders of Riga.

Today, 1201 is still celebrated as the founding of Riga by Albertintegral to the "bringer of culture" () myth created by later German and ecclesiastical historians that Germans discovered Livonia and brought civilization and religion to the virulently anti-Christian pagans.

Ascent of Riga as a center of German commerce (1201–1581)

Under Bishop Albert

1201 was equally significant in marking the first arrival of German merchants in Novgorod, traveling via the Dvina and overland.

Albert established ecclesiastical rule and introduced the Visby code of law. To insure his conquestReiner et al. Riga. Axel Menges, Stuttgart. 1999. and defend German merchant trade, the monk Theodoric of Estonia established the Order of Livonian Brothers of the Sword (Fratres Militiae Christi Livoniae, "Order") in 1202 under the aegis of Albert (who was away in Germany), open to both nobles and merchants.

Church history relates that the Livonians were converted by 1206, "baptized in a body" after their defeat at Turaida by German forces including the Liv king Kaupowho had been baptized under Meinhard around 1189,Uustalu, E. The History of Estonian People. Boreas Pub. Co., 1952. likely by Theodoric.Zeiferts, T. Ihsa Latwijas Whesture Skolai un wispahribai (A Brief History of Latvia for Scholastic and general use), Cooperative Society "School", Cēsis: 1920. 1207 marked Albert's start on fortification of the townZarina, D. Old Riga: Tourist Guide, Spriditis, 1992 (the city gates, Rātsvārti, are first mentioned in 1210Švābe, A., ed. Latvju Enciklopēdija. Trīs Zvaigznes, Stockholm. 1953–1955 (in Latvian)) and Emperor Philip's investing Albert with Livonia as a fiefMoeller et al. History of the Christian Church. MacMillan & Co. 1893. and principality of the Holy Roman Empire with Riga as capital and Albert as prince.Krause, et al. Theologische Realenzyklopädie. Walter de Gruyter, 1993. The surrounding areas of Livonia also came under levy to the Holy Roman Empire.Encyclopedia Americana, Scholastic Library Publishing, 2005. To promote a permanent military presence, territorial ownership was divided between the Church and the Order, with the Church taking Riga and two thirds of all lands conquered and granting the Order, who had sought half, a third. Until then, it had been customary for crusaders to serve for a year and then return home.

Albert had ensured Riga's commercial future by obtaining papal bulls which decreed that all German merchants had to conduct their Baltic trade through Riga. In 1211, Albert granted traders from Gotland the right to mint coins in the Bishopric of Riga, and Albert laid the cornerstone for the Riga Dom.Doma vēsture (history), Retrieved 29 July 2009 Riga was not yet secure as an alliance of tribes failed to take Riga. In 1212, Albert led a campaign to compel Polotsk to grant German merchants free river passage. Polotsk conceded Kukenois (Koknese) and Jersika, already captured in 1209, to Albert, recognizing his authority over the Livs and ending their tribute to Polotsk.Kooper, E. The Medieval Chronicle V. Radopi, 2008.

Opening the Dvina expanded German trade to Vitebsk, Smolensk, and Novgorod. Riga's rapid growth prompted its withdrawal from Bremen's jurisdiction to become an autonomous episcopal see in 1213.Palmieri, A. Catholic Origin of Latvia, ed. Cororan, J.A. et al.The American Catholic Quarterly Review Volume XLVI, January–October 1921. Philadelphia.

The oldest parts of Riga were devastated by fire in 1215.

In 1220 Albert established a hospital under the Order for the poor sick ("ad usus pauperum infirmantium hospitale in nova civitate Rige construximusus").R. Virchow. Archiv für pathologische Anatomie und Physiologie und für klinische Medicin. Georg Reimer, Berlin. 1861. In 1225 it became a Holy Ghost Hospital of Germanya lepers' hospital, although no cases of leprosy were ever recorded there. (In 1330 it became the site of the new Riga Castle.Turnbull, S.; ill. Dennis, P. Crusader Castles of the Teutonic Knights (2): The Stone Castles of Latvia and Estonia 1185–1560. Osprey Publishing. 2004.)

Albert's knitting of ecclesiastical and secular interests under his person began to fray. Riga's merchant citizenry chafed and sought greater autonomy; in 1221 they acquired the right to independently self-administer Riga and adopted a city constitution.