Domeyko enrolled at Vilnius University, then known as the Imperial University of Vilna, in 1816 as a student of mathematics and physics. He studied under Jędrzej Śniadecki. Involved with the Philomaths, a secret student organisation dedicated to Polish culture and the restoration of Poland's independence, he was a close friend of Adam Mickiewicz. In 1823–24, during the investigation and trials of the Philomaths, Domeyko and Mickiewicz spent months incarcerated at Vilnius' Uniate Basilian monastery.