According to Adam of Bremen and Saxo Grammaticus, in the 980s, Harald I of Denmark built a church and a royal estate in Roskilde. Saxo Grammaticus associates the name Roskilde with the legendary King Roar who possibly lived there in the 6th century. Harald was buried at the church which is on the same site as today's Roskilde Cathedral.
In 1020, Roskilde became a bishopric, making it the church's most important town in Denmark. Absalon, the Danish bishop, had a brick church built there in 1170 which later became the cathedral. In the following years, under Absalon's influence, many other churches were built in the town.
Roskilde was given the status of a market town in 1268. It was probably the largest and most important town in Denmark at the time. With the support of the Roman Catholic Church, it continued to thrive until 1443. But as a result of the Reformation and the closure of the Roman Catholic Church in Denmark it lost its earlier status. Roskilde Cathedral did, however, continue to be the place where the kings and queens of Denmark were buried.
The town suffered from plague, wars with the Swedes and a number of devastating fires in the 17th century but began to recover in the 18th century with the opening of the railway from Copenhagen in 1847. More recently, with the establishment of the Viking Ship Museum in 1969, Roskilde has been recognised as a cultural and educational centre in Denmark with the first Roskilde Festival in 1971 and the university which opened 1972