When he returned in 1667, he was named professor in mathematics at the newly founded Lund University; in 1672 he became the principal of that university. He retained this position until 1676 when the university was dissolved because of the Scanian War. During this war he fought on the Swedish side, and he held ground at the fortress in Jönköping. He fought at the Battle of Landskrona in 1677.