The castle was in a bad shape after the war and it took until 1654 before a restoration and reconstruction would begin. This time, the castle was to be turned into a baroque palace. Charles X Gustav was the king who ordered this, and Nicodemus Tessin the Elder was the architect engaged to fulfill the king's wishes. When Charles Gustaf died in 1660, the construction stopped, only to be restarted at a slow pace during the reigns of King Charles XI and King Charles XII. In 1709, the construction was finally completed.