At the age of nine, Alfons was sent to Russia as part of a rule for every Polish family to send a boy into the Imperial Russian Army.
Shanyavsky was soon promoted to general but poor health (tuberculosis) made him move to eastern Siberia on the invitation of Count Nikolai Nikolaevich Muravyov-Amursky.
He worked there as an adjutant and the staff there included Pyotr Kropotkin, Nikolai Yadrinsky, and Colonel K. N. Pedashenko.
Shanyavsky wished that his wealth would be used for establishing a free university, independent of authorities, where anyone could study.
A condition was that if the university was not begun before 3 October 1908, the funds would be transferred to the Saint Petersburg Women's Institute.