In 1808 he was commissioned as a lieutenant in the Danish Army; he took part in the Battle of Sehested (Schleswig-Holstein) during the Napoleonic Wars. After the Denmark-Norway union ended in 1814, Stockfleth joined the Norwegian Army as an officer posted to Valdres. He resigned from the army in 1823 to study theology, graduating in 1824. In March of the following year he became pastor of Vadsø, transferring to Lebesby in 1828 so that he could more easily meet with the nomadic Sami.