Around the 6th century AD there was an early Estonian stronghold on Toomemägi. In 1030 Yaroslav the Wise of Kyiv is said to have founded a fort here called Yuriev. The Estonians regained control, but in 1224 were defeated by the Knights of the Sword, who placed a castle, cathedral and bishop on Toomemägi. The town became known as Dorpat - its German name - until the end of the 19th century.
Throughout the 16th and 17th centuries Dorpat suffered repeated attacks and changes of ownership as Russia, Sweden and Poland-Lithuania fought for control of the Baltic region. Its most peaceful period was during the Swedish reign, which coincided with the university's founding in 1632. This peace ended in 1704, during the Great Northern War when Peter the Great took Tartu for Russia. In 1708 his forces wrecked the town and most of its population was deported to Russia.
In the mid-1800s Tartu became the focus of the Estonian national revival: the first Estonian Song Festival was held here in 1869, and the first Estonian-language newspaper was launched here - both important steps in the national awakening.
The peace treaty, which granted independence to Estonia (for the first time in its history), was signed in Tartu between Soviet Russia and Estonia on 2 February 1920. Tartu was severely damaged in 1941 when Soviet forces retreated, blowing up the grand 1784 Kivisild stone bridge over the river, and again in 1944 when they retook it from the Nazis. Both occupying forces committed many atrocities. A monument now stands on the Valga road where the Nazis massacred 12, 000 people at Lemmatsi.