Scandinavian and Russian traders and raiders used the Latgal, or Liv, fishing village on the site of modern Rīga for centuries before German traders first discovered it in the mid-12th century. In 1201 Bishop Albert von Buxhoevden from Bremen founded the first German fort in the Baltics here, as a bridgehead for the crusade against the northern heathens. He also founded the Knights of the Sword, who made Rīga their base for subjugating Livonia. Colonists from northern Germany followed, and Rīga became the major city in the German Baltic, thriving from trade between Russia and the West.
Sweden captured Latvia in 1621, and during this period Rīga was, effectively, the second city of Sweden. It was during this time that the city first expanded beyond its fortified walls. In 1710 Russia snatched Latvia from Sweden's grip and Rīga grew into an important trading and industrial city. Its population jumped to 28,000 in 1794 and 60,000 by the 1840s. While the old part of the city remained a preserve of Rīga's approximately 30,000 Germans, around it grew suburbs of wider, straighter streets with wooden houses, inhabited by the largest Russian community in the Baltic provinces as well as a growing number of Latvians.
Between 1857 and 1863 city walls were torn down to assist in the free flow of commerce. Rīga soon developed into the world's busiest timber port and Russia's third-greatest industrial city (after Moscow and St Petersburg). Russia's first cars were built here. And Rīga was renowned for the quality of the Lithuanian and Belarusian hemp and flax it exported to the outside world.
The city population skyrocketed in the 19th century, as Latvians recently freed from countryside serfdom migrated to Rīga and pushed their way into its trades, business, civil service and intellectual circles. By the 1860s about a quarter of the population was made up of former serfs. The Rīga Latvian Association, formed in 1868, became the core of the Latvian national awakening, inspiring a Latvian national theatre, opera, encyclopaedia and, in 1873, the first Latvian song festival. The number of Latvians in Rīga grew until they formed about half the city's population of 500,000 on the eve of WWI. There were significant communities of Jews and Western merchants - the city's last mayor before the war, George Armitstead, came from an English merchant family.
Rīga was badly damaged in both world wars. Following evacuations and other ravages, it was left with only 181,000 people at the end of WWI. The Germans departed after the Latvian land reform of the 1920s and Hitler's 'come home' call in 1939. In the Latvian independence era between the wars, Rīga was the centre chosen by Western diplomats, journalists and spies to eavesdrop on Stalin's Soviet Union. Flourishing nightclubs, restaurants and intellectual life earned it the nickname 'Little Paris'.
During WWII Rīga was occupied by the Germans from 1941 to 1944, and virtually all its Jewish community (estimated variously at 45, 000 to 100, 000) was exterminated. Thousands of Latvians left for the West towards the end of the war to avoid Soviet rule.
After the war the city became the industrial and commercial powerhouse of the USSR's Baltic region, and many migrated here to work. Rīga became the USSR's main source of railway engines and carriages, producing half its mopeds and a third of its washing machines, as well as trams, radios, telephone exchanges, robots and computers. The city sprawled as large numbers of migrants arrived, and Rīga became known as the most Western city in the USSR, with a liberal arts and music scene that attracted people from all over the union.
Today Rīga remains a bustling arts centre and, as the largest city in the Baltics, has acquired a reputation for its vibrant nightlife. The success of the city's 800th birthday party in 2001 - marked by a rash of historical buildings miraculously rising from the ashes - was sealed in 2002 by a budding young Russian-Rīgan singer striking gold in the Eurovision Song Contest. The city went on to host the great event in May 2003. In 2006 Rīga welcomed the World Ice Hockey Championships to its brand new state-of-the-art arena.