Kozłowski was a member of the Lithuanian Workers' Union and editor of its newspaper "Rabocheye Obozreniye". In 1899, together with Felix Dzerzhinsky, he contributed to the merger of the Lithuanian Workers' Union with the Social Democracy of the Kingdom of Poland into a single party Social Democracy of the Kingdom of Poland and Lithuania (SDKPiL). During the 1905 Revolution, he was a member of the military revolutionary organization and the strike committee in Vilnius. After the suppression of the revolution by the Tsarist government, he emigrated. In 1907 he was among the delegates to the 5th Congress of the RSDLP in London. Beginning in 1909, he led revolutionary agitation in the St. Petersburg Metalworkers' Union.