In the First Northern War from 1655 to 1660, during the reign of Charles X, Sweden was set on expansion. Through military action, Sweden rapidly became the strongest military power in the north.
Frederick III was suffering under the humiliating loss of traditional Danish provinces to Sweden in 1645. As Charles X appeared to be fully occupied in Poland, Frederick III judged the time appropriate for the recapture of the other Danish-Norwegian provinces. The King's Council agreed to war, a decision that led rapidly to ruin.
The Norwegian phase of the war went well. A Norwegian force of 2000 men recaptured Jemtland and Herjedalen. A Norwegian force set out from Bohuslän to join the Danish force invading Sweden from Skåne.
Reacting swiftly, by forced marches Charles X brought his hardened armies from Prussia to Holstein. Surprising the Danes, he advanced rapidly against limited opposition, taking Schleswig-Holstein and Jutland. Taking advantage of the unusually cold winter which froze the ice, Charles marched his armies across the ice onto the island of Zealand, leaving the humiliated Danes with no choice but to sue for peace on any terms.
As a result, the Treaty of Roskilde was negotiated in 1658. The terms were brutal: 
Then Charles X ignored the recently negotiated Treaty of Roskilde when he invested in Copenhagen in August 1658. The Norwegian army mobilized under the leadership of Jørgen Bjelke. His goal was to recapture Trøndelag and to defend the Norwegian border at Halden, which Charles X had demanded be turned over to Sweden as it provided both an excellent port for timber export from the newly acquired Bohuslän and a point from which further invasions could be launched. In September 1658 the new Swedish governor of Bohuslän invaded Norway with 1,500 men and attempted to invest Halden. The inhabitants put up a vigorous defense and the Swedes retreated to Bohuslän.
Five months later, in February 1659, the Swedes again attacked. Since the first attack, Bjelke had directed the garrison to be strengthened. Under the leadership of Tønne Huitfeldt, the Norwegians again repulsed the Swedish forces. Concurrently, Huitfeldt began the construction of fortifications. Cretzenstein, later to be renamed Fredriksten, was the citadel of the fortification system.
In early January 1660, the Swedish forces again attacked Halden; it was to serve as the base for their advance on Akershus in Oslo. In response to a demand for surrender, Huitfeldt stated that the 2,100 man garrison would defend Halden to the last man. After the attempt to storm the fortifications was unsuccessful, the Swedes prepared a regular investment. Under heavy bombardment the inhabitants begged the commandant to surrender, but putting his faith in his garrison, Huitfeldt held on. On February 22, 1660, the Swedes again were forced to retreat to Bohuslän. There they learned that Charles X had died.
Peace negotiations were reopened. Although Sweden demanded that Norway vacate all land to the river Glomma, which was to serve as the new border, with the intercession of Hannibal Sehested, a separate Scandinavian treaty, the Treaty of Copenhagen, was negotiated which reaffirmed much of the Treaty of Roskilde, except that Trøndelag was returned to Norway and the island Bornholm to Denmark, and the clause closing the Sound was removed.