Wars against Livs and Latgalians (1198–1209)
Christianity had come to Latvia with the settlement of Grobiņa by Swedes in the 7th century and the Danes in the 11th. By the time German traders began to arrive in the second half of the 12th century to trade along the ancient trade route from the Varangians to the Greeks, some natives had already been baptized.
Saint Meinhard of Segeberg arrived in Ikšķile in 1184 with the mission of converting the pagan Livonians, and was consecrated as Bishop of Üxküll in 1186. In those days the riverside town was the center of the missionary activities in the Livonian area.
The indigenous Livonians (Līvi), who had been paying tribute to the East Slavic Principality of Polotsk, and were often under attack by their southern neighbours the Semigallians, at first considered the Low Germans (Saxons) to be useful allies. The first prominent Livonian to be converted was their leader Caupo of Turaida, who was baptized around 1189.
Pope Celestine III had called for a crusade against pagans in Northern Europe in 1193. When peaceful means of conversion failed to produce results, the impatient Meinhard plotted to convert Livonians forcibly, but was thwarted. He died in 1196, having failed in his mission. His appointed replacement, bishop Berthold of Hanover, a Cistercian abbot of Loccum arrived with a large contingent of crusaders in 1198. Shortly afterward, while riding ahead of his troops in battle, Berthold was surrounded and killed, and his forces defeated by Livonians.
To avenge Berthold's defeat, Pope Innocent III issued a bull declaring a crusade against the Livonians. Albrecht von Buxthoeven, consecrated as bishop in 1199, arrived the following year with a large force, and established Riga as the seat of his Bishopric of Riga in 1201. In 1202 he formed the Livonian Brothers of the Sword to aid in the conversion of the pagans to Christianity and, more importantly, to protect German trade and secure German control over commerce.
As the German grip tightened, the Livonians and their christened chief rebelled against the crusaders. Caupo's forces were defeated at Turaida in 1206, and the Livonians were declared to be converted. Caupo subsequently remained an ally of the crusaders until his death in the Battle of St. Matthew's Day in 1217.
By 1208 the important Daugava trading posts of Salaspils (Holme), Koknese (Kokenhusen) and Sēlpils Castle (Selburg) had been taken over as a result of Albert's energetic campaigning. In the same year, the rulers of the Latgalian counties Tālava,
Autine established military alliances with the Order, and construction began on both Cēsis Castle and a stone Koknese Castle, where the Daugava and Pērse rivers meet, replacing the wooden castle of Latgalians.
In 1209 Albert, leading the forces of the Order, captured the capital of the Latgalian Principality of Jersika, and took the wife of the ruler Visvaldis captive. Visvaldis was forced to submit his kingdom to Albert as a grant to the Archbishopric of Riga, and received back a portion of it as a fief. Tālava, weakened in wars with Estonians and Russians, became a vassal state of the Archbishopric of Riga in 1214, and in 1224 was finally divided between the Archbishopric and the Order.