Built in 1330 as a base for the Livonian Order, the castle was destroyed several times during battles with the local townspeople. After the Order's destruction, the various occupiers of the city housed their governors inside. Latvia's first post-Cold War president Guntis Ulmanis made it his official office to continue the tradition begun by Latvia's interwar presidents in the 1920s and 1930s. It also housed the National History Museum of Latvia, but tragically, a fire broke out during renovations on June 21, 2013 and parts of the interior were gutted. Priceless historical objects from the museum that were stored in the basement were also damaged or destroyed.