Fasting was given command of the Royal Norwegian Navy after the union with Denmark ended in the spring of 1814, and was the commander of the navy during the war with Sweden. By fall of that year, he was a member of the interim government. In 1815, he was appointed minister in the Department of the Navy, and for the next 24 years he was Secretary of the Naval administrative.