At the close of the Northern War Charles X, having negotiated the Treaty of Roskilde in bad faith, invested Copenhagen in August 1658.
Under his orders, in September the new Swedish governor of Bohuslän invaded Norway with 1,500 men and attempted to invest Halden.
In early January 1660, the Swedish forces attacked Halden for the third time; it was to serve as the base for their advance on Akershus fortress in Christiania.
Under heavy bombardment the inhabitants requested the commandant to surrender, but putting his faith in his garrison, Huitfeldt held out.
In 1673 Denmark dispatched Ulrik Frederik Gyldenløve as statholder to Norway to organize the military forces and strengthen the defenses of the kingdom.
At the close of the Great Northern War, the Norwegian Army had been weakened in early 1716 by withdrawal of 5000 of the best troops to Denmark.
When rumors reached Christiania that Charles XII was preparing to invade, all remaining troops in Østerdal and Gudbrandsdal were ordered to the border at Halden and Fredrikstad.
After a brief occupation, Charles retraced his steps to the Norwegian fortresses in southeastern Norway with the objective of capturing Fredriksten.
His troops took the town after fierce fighting, but the citizens set fire to their own houses, forcing Charles, unable to take the fortress, to retreat and await the arrival of heavy siege guns.
Unfortunately for the invading army the entire Swedish transport fleet was captured or destroyed by the Norwegian naval hero Tordenskjold at the Battle of Dynekilen in Bohuslän.
The 1,400 strong garrison of Fredriksten fought ferociously to hold back the invasion, but suffered a severe setback when, on 8 December the forward fortification Fort Gyldenløve fell.
The death of the king effectively ended the attack on Fredriksten and the invasion was called off, leading to the conclusion of the war.
The discovery of a suitcase of objects during a clearance of a museum store at the fortress led to the rediscovery of the lifestory of Janken Wiel-Hansen, a Hansen born Norwegian-Swedish and pioneer in fencing and swordsmanship.