In 1840 he was assigned to the Vilnius Theological Seminary, where he lectured in pastoral theology and biblical archaeology and where he earned his doctorate in theology in 1842. That same year on orders of the Tsar, the Academy, its teaching staff and student body, was moved to St. Petersburg, Russia. Valančius came back to Lithuania because of health problems in 1845 and was appointed rector of the Varniai Theological Seminary, serving in this capacity until 1850. Having been absent from Lithuania during the anti-Russian uprising in 1831, Valančius was considered to be relatively apolitical, and thus the Russian government did not object when he was proposed as Episcopal candidate for the see of Samogitia.