The geography and topography of glacially carved, mountainous Norway constrain both the sea and the land routes which an aggressor must follow.
Early castles provided a strong defense against the attack of the day, and were normally taken by duplicity or siege.
In the age of black powder, cannon allowed breaching of the fortress walls and subsequent taking by storm.
Most Norwegian fortresses were constructed in the period of intense competition among the Baltic powers (Denmark-Norway, Sweden, Russia, Poland and the German states) for northern supremacy.
As one example, the danger of French domination under Louis XIV resulted in a 1668 triple alliance of England, Holland and Sweden.