During summer 1182, Magnus made an attempt to take Nidaros by siege, but was repulsed with grave losses when the Birkebeiners launched a surprise night attack. Sverre now started an extensive shipbuilding program. Without a fleet, he could have no hopes of expanding his influence further south. In spring 1183 Sverre attacked Bergen with parts of his new fleet. Avoiding detection by the enemy scouts, he caught the Heklungs off guard, seizing their entire fleet. Magnus fled to Denmark, leaving crown and sceptre behind.